Académique Documents
Professionnel Documents
Culture Documents
Chapter 9 Part A
Counters and Shift Registers
Counters
Types Design of State Table VHDL
Shift Registers
Types VHDL SR Based Counters
2
Counter Terminology 1
A Counter is a digital circuit whose outputs progress in a predictable repeating pattern. It advances on state for each clock pulse. State Diagram: A graphical diagram showing the progression of states in a sequential circuit such as a counter.
4
Counter Terminology 2
Count Sequence: The specific series of output states through which a counter progresses. Modulus: The number of states a counter sequences through before repeating (mod-n). Counter directions:
UP - count high to low (MSB to LSB) DOWN - count low to high (LSB to MSB).
Counter Modulus
Modulus of a counter is the number of states through which a counter progresses. A Mod-12 UP Counter counts 12 states from 0000 (010) to 1011 (1110). The process then repeats. A Mod-12 DOWN counter counts from 1011 (1110) to 0000 (010), then repeats.
State Diagram
A diagram that shows the progressive states of a sequential circuit. The progression from one state to the next state is shown by an arrow.
(0000 0001 0010).
Each state progression is caused by a pulse on the clock to the sequential circuit.
7
Truncated Counters 1
An n-bit counter that counts the maximum modulus (2n) is called a fullsequence counter such as Mod 2, Mod 4, Mod 8, etc. An n-bit counter whose modulus is less than the maximum possible is called a truncated sequence counter, such as mod 3 (n = 2), mod 12 (n = 4).
9 10
Truncated Counters 2
A 4-bit mod 12 UP counter that counts from 0000 to 1011 is an example of a truncated counter. A 4-bit mod 16 UP counter that counts up from 0000 to 1111 is an example of a full-sequence counter.
Truncated Counters 3
11
12
15
16
Synchronous Counters
A counter whose flip-flops are all clocked by the same source and change state in synchronization. The memory section keeps track of the present state. The control section directs the counter to the next state using command and status lines.
17
Synchronous Counters
18
19
20
Q2Q1Q0
000 001 010 011 100
J2K2
01 01 01 11 01 (R) (R) (R) (T) (R)
J1K1
00 11 00 11 00 (NC) (T) (NC) (T) (NC)
J0K0
11 11 11 11 01 (T) (T) (T) (T) (R)
Q2Q1Q0
001 010 011 100 000
21
22
VHDL UP Counter
-- simple_int_counter.vhd -- 8-bit synchronous counter with asynchronous clear. -- Uses INTEGER type for counter output. LIBRARY ieee; USE ieee.std_logic_1164.ALL;
27
28
29
30
LPM Counters 1
The Altera LPM (Library of Parameterized Modules) counter can be used to create counter designs in VHDL. This is a structured design approach that uses the LPM-counter as a component in a hierarchy. The LPM counter is instantiated in the structured design.
32
LPM Counters 2
The basic parameters of the LPM counter, such as width, are defined with a generic map. The port map is used to connect LPM counter I/O to the actual VHDL design entity.
33
END simple_lpm_counter;
35
37
38
39
40
41
42
44
45
46
47
48
Bi-Directional Counter
Adds a direction Input (DIR) to the counter and the control logic for up or down counting. Basic counter element is shown in Figure 9.50. The control logic selects the up or down count logic depending on the state of DIR.
50
51
52
53
54
55
56
59
60
10
65
66
11
Homework
Chapter 9
4, 6 (Modulus) 12 (Synchronous Counter) 20 (T Flip-flop Synchronous Counter) 22 (VHDL for 6-Bit Counter) 32 (Down Counter) 39 (Generic Width Counter)
68
ACLU #17
A counter is to count the Gray code pattern 000 001 011 010 110 111 101 100 000 etc. The inputs are Clk, ClkEn, and the counter outputs are Gray, and Cout. Write the entity statement Complete the Architecture
69
12