4-bit gray synchronous down counter using flip flop D

Thread Starter

th4mus

Joined May 5, 2024
1
Hi, I have no clue what to do, I've been searching for information about this for a week now, but I haven't found anything. I'm kinda frustrated because I don't know what I'm doing wrong. If you could help me out, that would be awesome.1714964900132.png1714964921096.png
 

MrChips

Joined Oct 2, 2009
31,106
Draw a truth table of all possible states 0000 to 11111.
For each state, write down the next state in new columns on the right. This is only the first step.
For example,

Current State -> Next State
0000 -> 0001
0001 -> 0011
0010 -> 0110
0011 -> 0010
 

dl324

Joined Mar 30, 2015
17,157
Welcome to AAC!
I'm kinda frustrated because I don't know what I'm doing wrong. If you could help me out, that would be awesome.
It would be helpful if you labeled the columns in your truth table and specified whether A is the LSB or the MSB.

The column you have highlighted is meaningless.

I refer to the schematic style you're using as a "netlist format"; meaning it's about as easy to read as a netlist.

This is how I drew a mod 6 gray code counter using JK flip flops:
1714969095227.png
I'm old school. A is *always* the LSB.
 

WBahn

Joined Mar 31, 2012
30,303
It would be helpful if you labeled the columns in your truth table and specified whether A is the LSB or the MSB.
A gray code doesn't really have an lsb or an msb. It is merely a sequence of states in which only one bit position changes value from one state to the next.

In the typical Reflected Gray Code, there is a reasonable illusion that there is an lsb and on up, mostly, because the "lsb" is the one that changes the most frequently, and this is the behavior we expect from an lsb of a counter. However, this illusion doesn't hold for the two "msb"s because they change at the same frequency and are simply in quadrature with each other.

The column you have highlighted is meaningless.
It looks like it is simply a number of the steps, which is useful for reference purposes. We can talk about Step 6, for instance.

It would be more useful if it were at the far left

It would also be very useful if the left and right sides of the table had headings, such as "Current State" and "Next State", instead of making us guess.

But, guessing that that's what the two halve are, the question is then whether or not they make sense.

Step 0: 0000 -> 1000
Step 15: 1000 -> 0000

Step 1: 0001 -> 1001
Step 14: 1001 -> 0001

It appears that each state goes to another state that then simply goes back to the state it came from.

Doesn't sound like a Gray code counter to me (well, I guess it is, it's essentially eight separate 1-bit Gray code counters, of which only one gets used, possibly depending on the phase of the moon).

I refer to the schematic style you're using as a "netlist format"; meaning it's about as easy to read as a netlist.
Another name is label-connected (or connection by name). It's, sadly, common among people that are too lazy to spend the time drawing a decent, well-laid-out schematic (I'm not talking about the TS necessarily, but rather engineers out in the "real world"). A much better approach is to connect prolific/global and well-known signals by label in order to reduce clutter, but route all other signals explicitly.

This is how I drew a mod 6 gray code counter using JK flip flops:
View attachment 321734
I'm old school. A is *always* the LSB.
I prefer using subscripts -- X_0 for the lsb on up -- that explicitly documents the weight of each bit (in a binary-weighted value). If people have to mentally convert 'C' to a weight of 2^2, they are apt to make a mistake, either just a silly goof, or by counting up and getting 2^3 because they overlooked that the exponent for the LSB is 0. Using subscripts also makes it easier to integrate the signals in a bus, if that is needed down the road.
 

WBahn

Joined Mar 31, 2012
30,303
Hi, I have no clue what to do, I've been searching for information about this for a week now, but I haven't found anything. I'm kinda frustrated because I don't know what I'm doing wrong. If you could help me out, that would be awesome.View attachment 321725View attachment 321726
What is it doing, or not doing, that is the issue. Don't make strangers on the Internet that you are asking for free assistance from try to reverse engineer your entire circuit in order to try to figure out what it MIGHT be doing wrong that MIGHT be what you are referring to.

Your table makes no sense.

Are the notations at the bottom of the columns on the right-half supposed to be the logic that produces the values in the column? If so, those should be at the TOP of the column, where people expect column descriptions to be.

What are A, B, C, and D and how do they relate to the signals on the left half? Don't make people have to guess or pull out crystal balls to read your mind.

If they are A through D from right to left, then does that make sense as far as your last column which is supposedly C XOR D? Looks like it's just a copy of D.

Again, that's if my crystal ball has read your mind correctly. Frankly, this darn thing has been wrong far more than it's been right, so describe what you are doing in enough detail so that I don't have to use it.
 
Top