26 |
|
|
27 |
|
|
28 |
#include "circuit.h" |
#include "circuit.h" |
29 |
|
#include "instr_word.h" |
30 |
|
|
31 |
// in[0] = Mpx4 ~= A1 ~= reg[src1] |
// in[0] = Mpx4 ~= A1 ~= reg[src1] |
32 |
// in[1] = Mpx5 ~= A2 ~= (reg[src2] || imm13 ) |
// in[1] = Mpx5 ~= A2 ~= (reg[src2] || imm13 ) |
34 |
|
|
35 |
class shifter : public circuit { |
class shifter : public circuit { |
36 |
public: |
public: |
|
enum dir { left, right }; |
|
37 |
shifter( int nout ) |
shifter( int nout ) |
38 |
: circuit(2, nout) {}; |
: circuit(2, nout) {}; |
39 |
void process( dir d ) { |
void process( instr_word op ); |
|
// FIXME: is this right?? |
|
|
// imm13 shr R[src1] == imm13 >> R[src1] ? |
|
|
// is specification right? |
|
|
if ( d == left ) |
|
|
set_out_all( get_in(1) << get_in(0) ); |
|
|
else |
|
|
set_out_all( get_in(1) >> get_in(0) ); |
|
|
} |
|
|
|
|
40 |
}; |
}; |
41 |
|
|
42 |
#endif |
#endif |