Barrel Shifter/Single CycleDatapathECE2030Shifter Implementation with MultiplexersA3A2A1A0B3B2B1B0000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sdd=1 shift right d=0 shift leftS=1 shiftS=0 no shift‘0’‘0’1 shifter (logical shift)A0A1A2A3A2A1A3A2A1A0B3B2B1B0000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sdd=1 shift right d=0 shift leftS=1 shiftS=0 no shift‘0’1 shifter (arithmetic shift)A0A1A2A3A2A1Shifter Implementation with Multiplexers000110114:1 MUXS0S1SdA3A3A2A1A0B3B2B1B0000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sdd=1 shift right d=0 shift leftS=1 shiftS=0 no shift1 shifter (rotational shift)A0A1A2A3A2A1Shifter Implementation with Multiplexers000110114:1 MUXS0S1SdA3A0Shifter Implementation with MultiplexersA3A2A1A0B3B2B1B0000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sd000110114:1 MUXS0S1Sdd=1 shift right d=0 shift leftS=1 shiftS=0 no shift‘0’‘0’2 shifter (logical shift)A0A1A3A2‘0’‘0’How do you build a arbitrary shifter with a collection of one-shifters??1-ShifterSd1-ShifterSdnnn1-ShifterSdnDirectionS0S1SnPROBLEM: NOT VERY EFFICIENT!To find a more efficient implementation consider a unsigned binary number.Hk Hk-1 … H2 H1 H014 22k2k-1…If Hi is 1 then add 2i to the total to get a decimal number!Barrel Shifter!1-ShifterSd2-ShifterSdnnn2k-ShifterSdnDirectionH0H1Hk4-ShifterSdn(Hk Hk-1 … H2 H1 H0 = Shift Amount)4 bit Barrel Shifter!Let H1Ho be the shift amount.Let d=1 mean shift right and d=0 mean shift left.1-ShifterSd2-ShifterSd44H0H1d4Example: H = 10 and H=11323232Shifter Unit in our datapathXY Y Contains theshift amount!!!Y>0 shift rightY<0 shift leftSUsu en2stst1st00 00 11 01 1LogicalArithmeticRotationalSINGLE CYCLE DATAPATHGeneral Purpose Register ArchitectureXYZrweau enlu ena/ssu enlfst42AULUSUlogical functionXkYkZk0 0 lf00 1 lf11 0 lf21 1 lf3Shift type (st)0 = logical1= arithmetic2= rotationalrwe = "register write enable"555addrregisterfile32 x 32X outY outwrite Z3232clkImmediate Register32- bit Immediate RegisterImmediate ValueConstant value that comes directly from instruction to datapathim enclk32XYZrweau enlu ena/ssu enlfst42AULUSU555addrregisterfile32 x 32X outY outwrite Z3232clk32- bit Immediate RegisterImmediate Valueim enclk32im en = low "Im Register" output is in the high impedance stateim en = high "Y out " is in the high impedance state32- bit Immediate RegisterImmediate Value --- will be only 16 bitsim enclk3216Sign extension of Immediate ValueSign extension3216clkim enI15I14I13I12I11I10I9I8I7I6I5I4I3I2I1I0I15I15I15I15I15I15I15I15I15I15I15I15I15I15I15I15I15I14I13I12I11I10I9I8I7I6I5I4I3I2I1I0Sign extension3216Assume negative number uses 2's complement!!!XYZrweau enlu ena/ssu enlfst42AULUSU555addrregisterfile32 x 32X outY outwrite Z3232clkSign extensionclkim enImmediate Value3216Single Cycle Datapath with Sign ExtensionTiming of Single Cycle DatapathXYZrweau enlu ena/ssu enlfst42AULUSU555addrregisterfile32 x 32X outY outwrite Z32323232clkSign extensionclkim enImmediate Value3216CLKRead and/or write valuesfrom/to register file (RF)Read and/or write valuesfrom/to register file (RF)Compute values in AU,LU, or SUClock cycle time is limited by the slowest functional unit!How do I control the datapath to do what I want??$R0 = $R1 + $R2X Y Z rwe imm en im va au en lu en lf su en sta/s1 2 0 1 0 X 1 0 0 xxxx 0 xRegister Transfer Level (RTL)XYZrweau enlu ena/ssu enlfst42AULUSU555addrregisterfile32 x 32X outY outwrite Z32323232clkSign extensionclkim enImmediate Value3216R3=R1 XOR R5How do I control the datapath to do what I want??X Y Z rwe imm en im va au en lu en lf su en sta/s1 5 3 1 0 X 0 x 1 0110 0 xXYZrweau enlu ena/ssu enlfst42AULUSU555addrregisterfile32 x 32X outY outwrite Z32323232clkSign extensionclkim enImmediate Value3216R5=4(R6)How do I control the datapath to do what I want??X Y Z rwe imm en im va au en lu en lf su en sta/s6 x 5 1 1 -2 0 x 0 xxxx 1 1XYZrweau enlu ena/ssu enlfst42AULUSU555addrregisterfile32 x 32X outY outwrite Z32323232clkSign extensionclkim enImmediate Value3216step X Y Z rwe imm en im vaa/sau enlu enlf su en stcontrol word OR microinstructionField = Associated group of control signalsLogic unit fieldArithmetic unit fieldShifter unit fieldDatapath Controlstep X Y Z rwe imm en im vaa/sau enlu enlf su en stR3=R1+R2-R5step X Y Z rwe imm en im vaa/sau enlu enlf su en stMultiple Steps: Microprograms and
View Full Document