Miscellaneous Circuit elements - muneeb-mbytes/computerArchitectureCourse GitHub Wiki

Sign extend

WhatsApp Image 2024-03-08 at 2 15 06 PM

consider a number is 16 bit and need to load it for register which is of 32 bits , at this point of time the msb bit of 16th bit of number is connected with remaining 16 msb bits of register, this is because to retain the polarity.

example:

WhatsApp Image 2024-03-08 at 2 31 47 PM

consider a simple example case where input is 4 bit(4 bit number) and output is 8 bit(8 bit register) thus sign extend is used,

WhatsApp Image 2024-03-08 at 2 08 27 PM

in the above figure it is clearly shown how the msb bit of inputs are tied to remamings msb bits of output, thus for sign extend no active elements are required

bits shifting

WhatsApp Image 2024-03-08 at 2 10 38 PM

bit shifting also don't require any active elements. consider making a left shift by 2, then 2 bits neeed to be shifted. this element can be easily understood using the simple 8 bit circuit element diagram.

WhatsApp Image 2024-03-08 at 2 11 58 PM

here input is shifted by 2 bits and the LSB bits are tied to zero. thus simple shifting is acheived without using any active elements.