Modulo-N Counters Lecture L8.4 Section 7.2. Counters Modulo-5 Counter 3-Bit Down Counter with Load and Timeout Modulo-N Down Counter.

Slides:



Advertisements
Similar presentations
Modulo-N Counters Module M10.4 Section 7.2.
Advertisements

VHDL Lecture 1 Megan Peck EECS 443 Spring 08.
Encoders Module M9.3 Section 6.3. Encoders Priority Encoders TTL Encoders.
Demultiplexers Module M6.4 Section 6.4. Demultiplexers YIN 1 x 4 DeMUX d0d1 Y0 Y1 Y2 Y3 Y0 Y1 Y2 Y3 d1d0 0 0 YIN YIN YIN
Shift Registers Module M11.1 Section 7.3.
7-Segment Displays Lecture L6.1 Section 6.3. Turning on an LED.
Latches and Flip-Flops Discussion D8.1 Section 13-9.
1 EE121 John Wakerly Lecture #10 Some shift-register stuff Sequential-circuit analysis.
Digital Logic Circuit Analysis & Design 王 军 王 军 王晓东.
Binary Counters Module M10.3 Section 7.2. Counters 3-Bit Up Counter 3-Bit Down Counter Up-Down Counter.
7-Segment Displays Lecture L6.7 Section 6.5. Turning on an LED.
Binary-to-BCD Converter Lecture L6.2 Section 6.5 pp
Using State Machines as Control Circuits Lecture L9.4.
Multiplier Lecture L7.3 Section 10.4 (p.276) Section 7.3 (Handout)
Pulse-Width Modulated DAC
Multiplexers Lecture L6.4 Section 6.4.
Subtractors Module M8.2 Section 6.2. Subtractors Half Subtractor Full Subtractor Adder/Subtractor - 1 Adder/Subtractor - 2.
1 CS 140 Lecture 19 Sequential Modules Professor CK Cheng CSE Dept. UC San Diego.
Designing State Machines Lecture L9.2 Handout Section 9.2.
Datapaths Lecture L10.2 Sections 10.2, ALU (Sect. 7.5 and Lab 6)
Arbitrary Waveforms Lecture L8.5 Section 7.2. CLK DQ !Q CLK DQ !Q CLK DQ !Q Q0Q0.D Q1 Q2 Q1.D Q2.D s s s s3 0 1.
Counters as State Machines Lecture L9.1 Handout Section 9.1.
Designing State Machines SQRT controller Lecture L9.2a Section 9.2.
Equality Detector Lecture L6.1 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
Flip-Flops Module M10.2 Section 7.1. D Latch Q !Q CLK D !S !R S R X 0 Q 0 !Q 0 D CLK Q !Q Note that Q follows D when the clock in high, and.
Counters Mano & Kime Sections 5-4, 5-5. Counters Ripple Counter Synchronous Binary Counters –Design with D Flip-Flops –Design with J-K Flip-Flops Counters.
Binary Counters Lecture L8.3 Section 8.2. Counters 3-Bit Up Counter 3-Bit Down Counter Up-Down Counter.
Shifter Lecture L7.4 Group HW #4 Section 10.3.
Counters Discussion D5.3 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
Codes and Code Converters
Code Converters Module M7.1 Section 6.5. Code Converters Binary-to-BCD Converters ABEL TRUTH_TABLE Command.
Arbitrary Waveforms Module M10.5 Section 7.2. CLK DQ !Q CLK DQ !Q CLK DQ !Q Q0Q0.D Q1 Q2 Q1.D Q2.D s s s s3 0 1.
Arithmetic Logic Unit (ALU) Lecture L7.5 Section 7.5.
Ring Counter Discussion 11.3 Example 32.
Pulse-Width Modulated DAC Lecture 11.3 Section 11.5.
Multiplexers Module M6.1 Section 6.4. Multiplexers A 4-to-1 MUX TTL Multiplexer A 2-to-1 MUX.
2’s Complement 4-Bit Saturator
Adders Lecture L7.1 Section 6.2 Section 10.4 (pp )
Shifters Lecture L7.4 Section 7.4. MODULE shift TITLE 'shifter' DECLARATIONS " INPUT PINS " D3..D0 PIN 11,7,6,5; D = [D3..D0]; s2..s0 PIN 3,2,1; S.
Arbitrary Waveform Discussion 12.2 Example 34. Recall Divide-by-8 Counter Use q2, q1, q0 as inputs to a combinational circuit to produce an arbitrary.
Flip-Flops Lecture L8.2 Section 8.1. Recall the !S-!R Latch !S !R Q !Q !S !R Q !Q X Y nand 1 0 Set 1 0.
Counters Discussion 12.1 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
Decoders Module M9.1 Section 6.3. Decoders TTL Decoders.
Arithmetic Logic Unit (ALU) Lecture L9.3 Lab 10. ALU CB = carry_borrow flag Z = zero flag (Z = 1 if Y = 0)
Shift Registers Lecture L6.6 Section Bit Shift Register.
Equality Detector Lecture L6.3 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
7-Segment Displays Module M7.2 Section 6.5. Turning on an LED Common Anode.
Flip-Flops Lecture L8.2 Section 7.1 – Book Sect. 8.1– Handout.
ECE 331 – Digital System Design Counters (Lecture #18)
Registers and Shift Registers Discussion D8.2. D Flip-Flop X 0 Q 0 ~Q 0 D CLK Q ~Q D gets latched to Q on the rising edge of the clock. Positive.
D Flip-Flops in Verilog Discussion 10.3 Example 27.
CS 140L Lecture 4 Professor CK Cheng 10/22/02. 1)F-F 2)Shift register 3)Counter (Asynchronous) 4)Counter (Synchronous)
Princess Sumaya Univ. Computer Engineering Dept. Chapter 6:
Department of Communication Engineering, NCTU 1 Unit 2 Reviews on Logic Elements.
Prof Jess 2008 DIGITAL IC COUNTERS Lecture 7.
Traffic Lights Discussion D8.3a. Recall Divide-by-8 Counter Use Q2, Q1, Q0 as inputs to a combinational circuit to produce an arbitrary waveform. s0 0.
A Greatest Common Divisor (GCD) Processor Lecture L10.3 Sections 10.4, 10.5.
EE121 John Wakerly Lecture #9
SYEN 3330 Digital SystemsJung H. Kim 1 SYEN 3330 Digital Systems Chapter 7 – Part 2.
Lab5-1 張明峰 交大資工系 Lab 5: FSM and BCD counters Implement the vending machine of lab 2 A two-digit BCD counter –two BCD counters –can load data in parallel.
Logiske funktioner i Peel. PEEL 18CV8 logic diagram.
Digital Logic & Design Dr. Waseem Ikram Lecture No. 35.
Supplement on Verilog FF circuit examples
D Flip-Flop.
Counters as State Machines
Using a State Machine to Design a Sequence Detector
Shift Registers Lecture L8.6 Section 8.3.
Designing Digital Circuits Using Hardware Description Languages (HDLs)
Analog-to-Digital Converters
Digital Logic & Design Dr. Waseem Ikram Lecture No. 36.
Presentation transcript:

Modulo-N Counters Lecture L8.4 Section 7.2

Counters Modulo-5 Counter 3-Bit Down Counter with Load and Timeout Modulo-N Down Counter

CLK DQ !Q CLK DQ !Q CLK DQ !Q Q0Q0.D Q1 Q2 Q1.D Q2.D s s s s s s X X X s X X X s X X X State Q2 Q1 Q0 Q2.D Q1.D Q0.D Modulo-5 Counter

s s s s s s X X X s X X X s X X X State Q2 Q1 Q0 Q2.D Q1.D Q0.D Modulo-5 Counter Q2 Q1 Q X 1 Q2.D Q2.D = Q1 & Q0 XX

s s s s s s X X X s X X X s X X X State Q2 Q1 Q0 Q2.D Q1.D Q0.D Modulo-5 Counter Q2 Q1 Q X X 1 Q1.D Q1.D = !Q1 & Q0 # Q1 & !Q0 X

s s s s s s X X X s X X X s X X X State Q2 Q1 Q0 Q2.D Q1.D Q0.D Modulo-5 Counter Q2 Q1 Q X 1 Q0.D Q0.D = !Q2 & ! Q0 XX

mod5cnt.abl MODULE mod5cnt TITLE 'Modulo-5 Counter' DECLARATIONS hex7seg interface([D3..D0] -> [a,b,c,d,e,f,g]); d7R FUNCTIONAL_BLOCK hex7seg; " INPUT PINS " CLK PIN 12; " 1 Hz clock (jumper) clear PIN 11;" switch 1 " OUTPUT PINS " Q2..Q0 PIN 41,43,44 ISTYPE 'reg'; " LED Q = [Q2..Q0]; " 3-bit output vector [a,b,c,d,e,f,g] PIN 15,18,23,21,19,14,17 ISTYPE 'com'; " Rightmost (units) 7-segment LED display

EQUATIONS Q.AR = clear; Q.C = CLK; Q2.D = Q1 & Q0; Q1.D = !Q1 & Q0 # Q1 & !Q0; Q0.D = !Q2 & !Q0; [a,b,c,d,e,f,g] = d7R.[a,b,c,d,e,f,g]; d7R.[D2..D0] = Q; d7R.D3 = 0; mod5cnt.abl (cont’d) Note Asynchronous Clear

mod5cnt.abl (cont’d) test_vectors(CLK -> Q).C. -> 1;.C. -> 2;.C. -> 3;.C. -> 4;.C. -> 0;.C. -> 1;.C. -> 2;.C. -> 3;.C. -> 4;.C. -> 0;.C. -> 1;.C. -> 2; END

Mod5cnt Simulation

Counters Modulo-5 Counter 3-Bit Down Counter with Load and Timeout Modulo-N Down Counter

CLK DQ !Q CLK DQ !Q CLK DQ !Q Q0Q0.D Q1 Q2 Q1.D Q2.D s s s s s s s s State Q2 Q1 Q0 Q2.D Q1.D Q0.D 3-Bit Down Counter

Q2 Q1 Q Q2.D Q2.D = !Q2 & !Q1 & !Q0 # Q2 & Q1 # Q2 & Q0 s s s s s s s s State Q2 Q1 Q0 Q2.D Q1.D Q0.D

3-Bit Down Counter Q2 Q1 Q Q1.D Q1.D = !Q1 & !Q0 # Q1 & Q0 s s s s s s s s State Q2 Q1 Q0 Q2.D Q1.D Q0.D

3-Bit Down Counter Q2 Q1 Q Q0.D Q0.D = ! Q0 s s s s s s s s State Q2 Q1 Q0 Q2.D Q1.D Q0.D

If load = 1, Load D to [Q2..0] MODULE dncnt3ld TITLE '3-bit Down Counter with Clear and Load' DECLARATIONS hex7seg interface([D3..D0] -> [a,b,c,d,e,f,g]); d7R FUNCTIONAL_BLOCK hex7seg; " INPUT PINS " CLK PIN 12; " 1 Hz clock (jumper) clear PIN 11;" switch S6:1 load PIN 7;" switch S6:2 D2..D0 PIN 4,3,2 ISTYPE 'com'; " switch S7:1-3 D = [D2..D0];" 3-bit input " OUTPUT PINS " Q2..Q0 PIN 41,43,44 ISTYPE 'reg'; " LED Q = [Q2..Q0]; " 3-bit output vector LED9, LED10 PIN 35,36 ISTYPE 'com'; " LED 9,10 timeout PIN 37ISTYPE 'com';" LED 11 [a,b,c,d,e,f,g] PIN 15,18,23,21,19,14,17 ISTYPE 'com'; " Rightmost (units) 7-segment LED display dncnt3ld.abl timeout = 1 when [Q2..0] = [0,0,0]

EQUATIONS LED9 = clear; LED10 = load; Q.C = CLK; Q.AR = clear; WHEN load THEN Q.D = D; ELSE { Q2.D = !Q2 & !Q1 & !Q0 # Q2 & Q1 # Q2 & Q0; Q1.D = !Q1 & !Q0 # Q1 & Q0; Q0.D = !Q0; } timeout = !Q0 & !Q1 & !Q2; [a,b,c,d,e,f,g] = d7R.[a,b,c,d,e,f,g]; d7R.[D2..D0] = Q; d7R.D3 = 0; dncnt3ld.abl (cont’d) If load = 1, Load D to [Q2..0] timeout = 1 when [Q2..0] = [0,0,0] Down counter equations

test_vectors([CLK, clear, load, D] -> [Q, timeout]) [.c.,1,0,0] -> [0,1]; [.c.,0,0,0] -> [7,0]; [.c.,0,0,0] -> [6,0]; [.c.,0,0,0] -> [5,0]; [.c.,0,0,0] -> [4,0]; [.c.,0,0,0] -> [3,0]; [.c.,0,1,5] -> [5,0]; [.c.,0,0,0] -> [4,0]; [.c.,0,0,0] -> [3,0]; [.c.,0,0,0] -> [2,0]; [.c.,0,0,0] -> [1,0]; [.c.,0,0,0] -> [0,1]; [.c.,0,0,0] -> [7,0]; END dncnt3ld.abl (cont’d)

dncnt3ld Simulation

Counters Modulo-5 Counter 3-Bit Down Counter with Load and Timeout Modulo-N Down Counter

3-Bit Down Counter with Load and Timeout To make a modulo-N counter, load I2..I0 with N-1 when timeout = 1

EQUATIONS LED9 = clear; LED10 = load; Q.C = CLK; Q.AR = clear; WHEN (load # timeout) THEN Q.D = D; ELSE { Q2.D = !Q2 & !Q1 & !Q0 # Q2 & Q1 # Q2 & Q0; Q1.D = !Q1 & !Q0 # Q1 & Q0; Q0.D = !Q0; } timeout = !Q0 & !Q1 & !Q2; [a,b,c,d,e,f,g] = d7R.[a,b,c,d,e,f,g]; d7R.[D2..D0] = Q; d7R.D3 = 0; modndcnt.abl (modified dncnt3ld.abl) If timeout = 1, Load D to [Q2..0] timeout = 1 when [Q2..0] = [0,0,0] Down counter equations

Modulo-5 Counter [D2..D0] = [1,0,0]