N-Bit Comparator

Thread Starter

icelated

Joined Oct 15, 2010
12
I have a problem where i am trying to make a moore state diagram to compare two inputs form current state to next state. I only know how to do a sequence. I am not sure how i would get to the next state?
Any help is very appreciative.

Question:

3) A sequential network has two inputs and two outputs. The inputs (X1 X2) represent a 2-bit binary number, N. If the present value of N is greater than the previous value, then Z1 is 1. If the present value of N is less than the previous value, then Z2 is 1. Otherwise, Z1 and Z2 are 0. Draw the Moore state graph for the circuit. (hint, the minimum number of state including the starting state is 11. If you do this as a Mealy state diagram you can do it in 5 states.)

this is the only thing i have come up with

Z1 = 1 if present value > current value
Z2 = 1 if present value < previous value
Z1 = Z2 = 0 if present value = current value.

Also, i would imagine that each state would have something like A< B or A> b or A = B? but thats only a few states. I dont see how we could possibly have 11 states?
Any help is much appreciative. Any hints? Any thoughts on how to go about this? I am just a software engineering student trying to get through digital logic. THANK YOU
 

TweedleDee

Joined Nov 9, 2010
5
Without actually going through it all, I can come up with 10 states and maybe a initial state would make it 11. So, say N is the current number and P is the previous number. If P = 0 and N = 1, then you would have a state where N = 1 and the output is Z2 = 0, Z1 = 1. You could also have a state where N = 1 and P = 1 and the output would be Z2 = 0, and Z2 = 0. So, for N = 0, you could have 2 states,and for N = 1 you could have 3 possible states, and so on.
 

Georacer

Joined Nov 25, 2009
5,182
Let's see...
One state for every number from 00 to 11 and one state for every output 00,01 and 10.

A really no-brainer solution would be to have 12 states (4x3) that will correspond to the N number being either greater, lesser or equal to the previous input. And a dense cobweb of arrows.
 
Top