Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shift Registers Lecture L6.6 Section 7.3. 4-Bit Shift Register.

Similar presentations


Presentation on theme: "Shift Registers Lecture L6.6 Section 7.3. 4-Bit Shift Register."— Presentation transcript:

1 Shift Registers Lecture L6.6 Section 7.3

2 4-Bit Shift Register

3 shift4.abl MODULE shift4 TITLE '4-bit Shift Register' DECLARATIONS " INPUT PINS " CLK PIN 70; " push-button switch (clock) clear PIN 11; " Switch S6:1 data_in PIN 1; " Switch S7:4 " OUTPUT PINS " Q3..Q0 PIN 40,41,43,44 ISTYPE 'reg buffer'; " LED 13..16 Q = [Q3..Q0]; " 4-bit output vector

4 shift4.abl (cont’d) EQUATIONS Q.AR = clear; Q.C = CLK; Q3.D = data_in; Q2.D = Q3; Q1.D = Q2; Q0.D = Q1;

5 @radix 16; test_vectors([CLK, clear, data_in] -> Q) [.C.,1,0] -> 0; [.C.,0,1] -> 8; [.C.,0,0] -> 4; [.C.,0,0] -> 2; [.C.,0,0] -> 1; [.C.,0,0] -> 0; [.C.,0,1] -> 8; [.C.,0,0] -> 4; [.C.,0,1] -> 0A; [.C.,0,0] -> 5; [.C.,0,1] -> 0A; [.C.,0,0] -> 5; [.C.,0,0] -> 2; [.C.,0,0] -> 1; [.C.,0,0] -> 0; END shift4.abl (cont’d)

6 shift4 simulation

7 Ring Counter

8 ring4.abl MODULE ring4 TITLE '4-bit Ring Counter' DECLARATIONS " INPUT PINS " CLK PIN 70; " push-button switch (clock) start PIN 11; " Switch S6:1 " OUTPUT PINS " Q3..Q0 PIN 40,41,43,44 ISTYPE 'reg buffer'; " LED 13..16 Q = [Q3..Q0]; " 4-bit output vector Q31 = [Q3..Q1];" upper 3 bits

9 ring4.abl (cont’d) EQUATIONS Q31.AR = start;" asynchronous reset Q0.AP = start;" asynchronous preset Q.C = CLK; Q3.D = Q0; Q2.D = Q3; Q1.D = Q2; Q0.D = Q1; 0 0 0 1 start = 1

10 @radix 16; test_vectors([CLK, start] -> Q) [.C.,1] -> 1; [.C.,0] -> 8; [.C.,0] -> 4; [.C.,0] -> 2; [.C.,0] -> 1; [.C.,0] -> 8; [.C.,0] -> 4; [.C.,0] -> 2; [.C.,0] -> 1; [.C.,0] -> 8; [.C.,0] -> 4; [.C.,0] -> 2; [.C.,0] -> 1; END ring4.abl (cont’d)

11 ring4 simulation

12 Ring Counter

13 Johnson Counter

14 Exercise Detect input sequence 1101 fsm din dout clk clr din dout 1 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0

15 Use Shift Register CLK DQ !QCLK DQ !QCLK DQ !QCLK DQ !Q CLK Q3Q2Q1Q0 1011 dout din

16 A Random Number Generator

17 Q3 Q2 Q1 Q0 0 0 0 1 1 1 0 0 0 8 1 1 0 0 C 1 1 1 0 E 1 1 1 1 F 0 1 1 1 7 1 0 1 1 B 0 1 0 1 5 Q3 Q2 Q1 Q0 1 0 1 0 A 1 1 0 1 D 0 1 1 0 6 0 0 1 1 3 1 0 0 1 9 0 1 0 0 4 0 0 1 0 2 0 0 0 1 1


Download ppt "Shift Registers Lecture L6.6 Section 7.3. 4-Bit Shift Register."

Similar presentations


Ads by Google