# Stuck on homework.

#### Alexandroas

Joined Nov 11, 2019
6
The homework states the following:
"Create a 4-bit clocked sequential circuit with one input line X. When X=0 the circuit goes through the transitions from 000,0001,0010.....1111 and back to 0000 and repeat/ When X=1 the state of the flip flop does not change."

Question 1. Show the state diagram.
Question 2. Show the state table.
Question 3. Show the k map for each input of each flip flop, simplify and create the input functions.
Question 4. Use Microsoft visio to construct an electronic version of the circuit.

I have completed up to question 3 but i can't seem to figure out the 4th question. Maybe i have done something wrong and it doesn't make sense?
The flip flop i am using a toggle flip flop, since there are values that need to be retained.

#### Attachments

• 14.2 KB Views: 8
• 10.5 KB Views: 6

#### dl324

Joined Mar 30, 2015
13,837
Welcome to AAC!

Is this the way they're teaching you to create a state table? The order is bizarre.

The most common method is to arrange the rows in gray code order which would facilitate transferring data to your Kmaps (which are in gray code order).

Why didn't you put the table and maps in the same spreadsheet so it would be easier to transfer data from the table to the maps?

#### Alexandroas

Joined Nov 11, 2019
6
That's the way he taught us. Had to put the maps and the table in a separate file, that's how he wanted it.

#### Alexandroas

Joined Nov 11, 2019
6
Is everything correct up to this point at least? I have been bashing my head against the wall these past 4 days trying to figure it out and the deadline is until tomorrow.

#### dl324

Joined Mar 30, 2015
13,837
That's the way he taught us. Had to put the maps and the table in a separate file, that's how he wanted it.
You could have done it the more convenient way and then broken things up the way he wanted. BTW, his way makes no sense.
Is everything correct up to this point at least?
You have an error in one of the rows and you haven't populated your Kmaps correctly.
I have been bashing my head against the wall these past 4 days trying to figure it out and the deadline is until tomorrow.
You have plenty of time. It took me about half an hour to create kmaps and equations from your data.

I don't like the way they're teaching students these days. When I was in school, D was always used to represent 2³ (look at some 74xx TI counter datasheets).

#### Alexandroas

Joined Nov 11, 2019
6
What do you mean i haven't populated the maps correctly?

#### ci139

Joined Jul 11, 2016
1,696
Following is not a question to answer but to consider
i know this will upset you , but why X included in transition table (or included in transition table as LSB) , ((your Karnaugh maps are cryptic))
the function of X is just CE enable latch/count
clocked sequential circuit
(as far as i get ↑) assumes a CLK line being present . . .
/// ? or do you need to synthesize clock from outputs
/// based on (the hypothetical) "average transfer delay" ?
. . . so you just get the (internal to counter clock) CLK.int = X & CLK.ext ???

otherwise you can use the Excel to verify your state tables and K-maps see help for vlookup() : syntax , example
hint : use vlookup(target,range,offsetFromLeft,match) as vlookup(a11,$k$1:$m$100,2,0) for drag-populating the formulas
! also the key field must be sorted . . . and sorted ascending (if you don't have unique (lookup)index (as your column A in state table.xlsx) . . . then create one )
! also add one more index at the bottom to be returned if no match was found !!!

Last edited:

#### Alexandroas

Joined Nov 11, 2019
6
The x was included in the table in order to show that when x=0 the circuit transitions from 0000 to 0001 and so forth.

#### dl324

Joined Mar 30, 2015
13,837
What do you mean i haven't populated the maps correctly?
You haven't transferred data from the table to the maps correctly. Because you didn't use gray code order in the table, you need to pay close attention to where you put the data in the maps.

#### dl324

Joined Mar 30, 2015
13,837
The x was included in the table in order to show that when x=0 the circuit transitions from 0000 to 0001 and so forth.
As an example, all of the 1's in the map for P=1 are wrong. A sanity check would have told you that was the case.

#### Alexandroas

Joined Nov 11, 2019
6
As an example, all of the 1's in the map for P=1 are wrong. A sanity check would have told you that was the case.
View attachment 191128
I am so sorry but..... i really don't get it, my brain is fried at the moment.... Are all of the k maps wrong or is it the last one? Could please give me an example of how it should be?

#### dl324

Joined Mar 30, 2015
13,837
I am so sorry but..... i really don't get it, my brain is fried at the moment.... Are all of the k maps wrong or is it the last one? Could please give me an example of how it should be?
All of the maps are wrong.

For example, you show the data in the bottom right corner in the P=1 map to be from the line you labeled 26. It should be from the line you labeled 21.

#### WBahn

Joined Mar 31, 2012
26,398
Welcome to AAC!

Is this the way they're teaching you to create a state table? The order is bizarre.

The most common method is to arrange the rows in gray code order which would facilitate transferring data to your Kmaps (which are in gray code order).

Why didn't you put the table and maps in the same spreadsheet so it would be easier to transfer data from the table to the maps?
Every text I've seen (which, of course, is only a small sampling of what's out there) puts the state table in binary order. There are advantages and disadvantages either way. For a problem like this, since it's a binary counter, I would say that the advantages of listing the states in binary order outweigh disadvantages, provided a bit of thought is put into the order of the inputs. If the X input is first, followed by ABCD, then not only does the table become trivially easy to write, but the chances of making a mistake go way down and the ease of catching any mistakes go way up. If they are in Gray Code order then a lot more care has to be taken to make sure that each row is correct and catching mistakes is harder since it lacks the binary-ordered pattern that humans pick up pretty easily.

#### ci139

Joined Jul 11, 2016
1,696
you will need an (internal) extra bit that shows your counter's (dynamic) direction
or you will not be able (*) to determine which way to go from say 1010 --e.g.-- ? should the next (state) be 1001 or 1011 /!\
. . . which means you will/"need to" map the total 0 to 15 + 14 to 1 states =16+14 = 30 states + 2 "state -- don't care" states (never enterd) to complete the karnaugh maps for . . .
so your signals : CLK , X , A , B , C , D , DIR ::
X -- enable count
CLK -- clock
A to D -- LSB to MSB // or the way around if you select so
DIR -- direction flag // set @ or after the 1111 is reached -- and reset after the 0000 is reached (*)
___________________
Updated the XLS to the more bug-free version . . .the "don't care" values are actually at 16 and 31 on karnaugh maps . . . also the columns n (A) to S (H) does not correspond to columns d (J) to s (N) after(below) the row 18 . . . the Sheet2 uses logic expressions from Sheet1 to check their validity
+Update 2 -- fn. 4 the intermal "direction bit" inc.-d

#### Attachments

• 100.5 KB Views: 2
Last edited:

#### dl324

Joined Mar 30, 2015
13,837
If they are in Gray Code order then a lot more care has to be taken to make sure that each row is correct and catching mistakes is harder since it lacks the binary-ordered pattern that humans pick up pretty easily.
If the table and Kmaps are in gray code order, transferring data is straightforward. We'll just have to agree to disagree.

In this case, the Kmaps are in gray code order and the table isn't. That makes no sense.

#### WBahn

Joined Mar 31, 2012
26,398
If the table and Kmaps are in gray code order, transferring data is straightforward. We'll just have to agree to disagree.

In this case, the Kmaps are in gray code order and the table isn't. That makes no sense.
We can certainly agree to disagree, no problem there.

I agree that if the table is in Gray code order that transferring the data is somewhat easier -- that's the principle advantage of putting them in Grady code order.

I don't know the point that you are trying to make about that the Kmaps are in gray order in this case -- aren't they always organized in gray code order since that's what the graphical minimization approach relies on?

Consider the following two tables where the left one is in binary order and the second is in Gray. Each table has an error in it. I maintain that, for the vast majority of people, the mistake is easily found and fixed in the left set and significantly more likely to go uncaught in the right.

The more people know about the pros AND cons of various approaches, the better they are able to make decisions about which approach to use that works best for them.

#### dl324

Joined Mar 30, 2015
13,837
I don't know the point that you are trying to make about that the Kmaps are in gray order in this case -- aren't they always organized in gray code order since that's what the graphical minimization approach relies on?
Karnaugh's maps are an improvement on prior methods. At least one of them used maps/diagrams in binary order.

Last edited:

#### WBahn

Joined Mar 31, 2012
26,398
Karnaugh's maps are an improvement on prior methods. At least one of them used maps/diagrams in binary order.
Do you have any references or perhaps just names that were used for those methods? It would be interesting to take a look at them -- sometimes the old and forgotten techniques had hidden pearls that can still be useful even in the age of "more sophisticated" approaches.

#### dl324

Joined Mar 30, 2015
13,837
Do you have any references or perhaps just names that were used for those methods?
They're referenced on Wikipedia.

I read somewhere that Veitch contemplated gray code order but decided not to.

#### WBahn

Joined Mar 31, 2012
26,398
Thanks a lot!