digital-logic

Using opcodes in digital circuit design


I'm working on a circuit which performs basic operations such as addition and subtraction using logic gates.

Right now, it takes 3 inputs, two 4 bit numbers, and a 3 bit opcode which indicates what operation to perform.

It seems that a 3-8 decoder would be a good idea here. This is my mockup!

enter image description here

To give a little more context, here is what my adder circuit looks like (+). I designed it to take two 4 bit numbers X & Y:

enter image description here

However, what I am confused about is the fact that I have to feed in 4 inputs or 4 wires to each of the circuit that handles it's respective operations (+, -, =, etc). It appears to only connect one wire to the circuit I need to get to. I need to actually connect 8 wires, as I have to feed in the to 4 bit numbers.

UPDATE: I ended up using a MUX to select the output that I want.

enter image description here


Solution

  • An adder doesn't need an input to tell it to add, because that's all it does.

    A 4-bit full adder should have

    Your decoder is a separate component from all the function generators. You could put a tristate buffer on each function generator to connect them to a common data bus, and then the decoder would generate the tristate enable signals. Otherwise, you probably don't need a decoder, but you might look at a multiplexer (mux) instead.