BCD Up-Counter Schematic Error

digital-logiciseschematicssimulation

When I try to simulate my schematic for my up counter, i get the error

Net "Net-name" cannot be connected both to an input port and an instance output pin.

Here is my schematic

I am pretty sure the error is because of how to output of the flip flops is sent back into the input, but I thought that is how the design of an up-counter is supposed to be implemented. Is that not true?

I found this when searching the error, which states:

"Error: DesignEntry:222" indicates that an I/O Marker with an Input Port polarity is connected to an output pin of one of the symbol instances in the schematic drawing. This is not allowed, as it would create an electrical source conflict.

I think that this is my problem, but I am not sure what to do about it. I would appreciate any help, thank you.

Best Answer

"I tied the outputs to the inputs so that the current state will affect the next state (so if current state is 0000, that number will go through my logic and the next state will come out of the flip flops as 0001)."

Mealy Machines

You are correct that a mealy machine's next input is affected by the current state, and the inputs, but you're going about it the wrong way.

You can't just simply tie the output back to the input line. That doesn't make any sense, because you have 2 driving elements for a single line. If your input line doesn't match the output line tied to it, you have a short!


Since you're learning about mealy machines, I'm sure you've already done state diagrams.

They don't teach you them for no reason.

You need to start off with a state diagram of your mealy machine, like this:

enter image description here

You draw a bubble for each possible state, arrows between transitions determining what state change occurs depending on current state and input. You see numbers like 0/0. This means the input was a 0, and the output during the transition was a 0. So in the above diagram, in state S0 with an input of 0, the state changes to S1 and the output is a 0.

After you have a completed state diagram, you can then make a state transition table.

State transition table

enter image description here

You fill in the state transition table from the values in your state diagram.

You also need to encode your states in some binary form, such as in a state encoding table

enter image description here

With your states now encoded, you can substitute the encoded values into your above state table and end up with something like this:

enter image description here

Notice how now, instead of a single column for next state, you have 2 columns for each bit of the next state.

I usually tack on the outputs to the right side of my encoded state table, but you also need the values for your outputs.

These images are not from the same example, so they won't make sense together. They are just examples of the tables enter image description here

At this point, you can then translate these into karnaugh maps or deduce the logic you will need for the circuit.

Karnaugh Maps

If your logic is fairly complex, karnaugh maps will be the best way to go.

You will need to create a karnaugh map for each bit of the next state, and each bit of the output.

So for example in the above tables (excluding the last one), there are 2 next-state bits, so I would need a separate karnaugh map for each of those bits. Then I would need another for the output bit. Each map could have horizontal axis being both current state bits, and vertical axis being both input bits.

In review, here are the steps you need to take, in order

enter image description here

Finally, you may end up with something that looks similar to this (but perhaps more complex):

enter image description here

So yes, there is a feedback where the output affects the next state, but it doesn't just tie directly to the input line. It most likely will go into some combinational logic, like a gate that is shared with the input

Photo Credit All images come from the text Digital Design and Computer Architecture, 2nd Edition, by David Money Harris and Sarah L. Harris, pgs. 133-140

Related Topic