Electronic – How to implement a rotate left 1 bit operation in a 16-bit ALU in logisim

aludigital-logiclogisim

I'm creating a 16-bit ALU that has to perform logical AND, logical OR, addition, subtraction and rotate left one bit. I have everything working perfectly except the rotate left one bit. I think I need to implement this at the 16-bit level instead of inside the 1-bit ALU, which I've chained together to create the 16-bit ALU. Any advice on how to do this would appreciated. I'm thinking it has something to do with the carry out bit, but I can't quite figure it out.

Best Answer

The simplest thing is to just add the input number to itself. Doubling a number (multiplication by 2) is equivalent to a left shift in binary. In other words, select ADD as the ALU operation, and feed the input value to both inputs of the ALU. If you do add-with-carry, then the carry bit will automatically get shifted into the LSB. In either case, the carry-out will be the MSB of the original input number.