13.07.2015 Views

ModuleWare Reference Guide - Hornad

ModuleWare Reference Guide - Hornad

ModuleWare Reference Guide - Hornad

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Bit Manipulation PartsFixed Shifter (fixshift)Fixed Shifter (fixshift)This part shifts the bits of the input bus din and places the result on theoutput bus dout.There are three shift modes which are selected by the enumeratedparameter mode (Logical, Arithmetic, Circular).The parameter shift specifies the number of places the bits will be shifted.The direction of the shift operation is specified by the sign of parametershift. If the value is < 0, it is a shift right operation. If the value is > 0, it isa shift left operation.For logical mode, 0 is shifted in for both left and right shift operations. For arithmetic mode, 0 isshifted into the least significant (LSB) bit for left shift but for right shift the most significant bit(MSB) is retained. For circular mode, right shift shifts the LSB to the MSB while the left shiftshifts the MSB to the LSB.FunctionIf mode = logical:dout= din >> shift= din 0 (0 is placed in the LSB)if shift = 0If mode = arithmetic:dout= din >> shift= din 0 (0 is placed in the LSB)if shift = 0If mode = circular:dout= din >> shift= din 0 (MSB of din is placed in the LSB)if shift = 0Truth TableA 4-Bit input example (mode = logical):Table 5-29. Fixed Shifter Truth Table — Mode = Logicaldin shift dout1101 5 00001101 2 01001101 -2 00111101 -5 000094<strong>ModuleWare</strong> <strong>Reference</strong> Manual, Library Version 1.9September 18, 2008

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!