Recall the functionality of a 2×1 multiplexor:
For convenience, we draw the Mux circuit rotated 90-degrees:
|
EDiSim macro definition for this circuit using EDiSim's built-in Mux component:
Define Shifter c d3 d2 d1 d0 | z3 z2 z1 z0; /* Bit 3 */ Mux aa c | ZERO d2 | z3; /* Bit 2 */ Mux aa c | d3 d1 | z2; /* Bit 1 */ Mux aa c | d2 d0 | z1; /* Bit 0 */ Mux aa c | d1 ZERO | z0; Endef; |
How to run the program:
/home/cs355001/bin/cs355sim /home/cs355001/demo/circuits/shifter |