daisordan
Newbie level 6
I would like to compare the signal using verilog. Lets say I have a counter that output a random number in random timing. The clock is 20ns. For example:
count = 1 (20ns)
count = 3 (40ns)
count = 5 (80ns)
count = 3 (100ns)
Then I will have a output z, which will become 1 when the count value is changed. In this example:
z = 1 (20ns)
z = 1 (40ns)
z = 1 (80ns)
z = 1 (100ns)
I have tried to store the count value and do the comparison therefore I need to use synchronous logic. But the z will output 1 clock cycle late since the synchronous. If I use combinational assign, it cannot store the value and do compare.
Anyone can give me some hints how can I solve this problem?
Thanks
count = 1 (20ns)
count = 3 (40ns)
count = 5 (80ns)
count = 3 (100ns)
Then I will have a output z, which will become 1 when the count value is changed. In this example:
z = 1 (20ns)
z = 1 (40ns)
z = 1 (80ns)
z = 1 (100ns)
I have tried to store the count value and do the comparison therefore I need to use synchronous logic. But the z will output 1 clock cycle late since the synchronous. If I use combinational assign, it cannot store the value and do compare.
Anyone can give me some hints how can I solve this problem?
Thanks