Adding 4-bit numbers to 16-bit shift register

clockdigital-logicshift-register

I am trying to find a way to add four 4-bit binary numbers to a 16-bit shift register, one(group of 4 bits) by one. This way I can store 4 decimal numbers(0-9) in the register, adding them by pushing 1 of 10 buttons labeled from "0" to "9"(simple push buttons).

I thought of something but I think it's wrong:

Step one: load 4-bit data

enter image description here

Step two: shift them four times

enter image description here

Step three: load 4-bit data again

enter image description here

But the simulator say it does not know the values of the shifted bits.

Another way would be adding the numbers bit by bit, using only the "shift" and the "input pin", but it won't be easy since there's a clock.

What is the best way of doing it?

Best Answer

The LOAD DATA input isn't just loading the high 4 bits, it's loading all 16. Since you have no inputs connected to the other 12 bits, the stored values are going to the unknown or 'x' state.

You can easily fix this by just using 4 4-bit shift registers. If the LOAD DATA input only controls one of the four, the other registers won't be affected when you load the first one.

schematic

simulate this circuit – Schematic created using CircuitLab

The circuit you have currently is equivalent, but with all the LOAD pins tied together.

Related Topic