/* * $Id: shifter.h,v 1.1 2002/11/26 22:27:33 misto Exp $ */ #ifndef SMARC_PROC_SHIFTER_H #define SMARC_PROC_SHIFTER_H #include "circuit.h" class shifter : public circuit { public: enum dir { left, right }; shifter( int nout ) : circuit(2, nout) {}; void process( dir d ) { for( int i = 0 ; i < num_out() ; i++ ) if ( d == left ) set_out( i, get_in(0) << get_in(1) ); else set_out( i, get_in(0) >> get_in(1) ); } }; #endif