Shift Registers - PowerPoint PPT Presentation

About This Presentation
Title:

Shift Registers

Description:

Shift Registers Lecture L8.6v (Verilog) Section 8.3 Ring Counter Johnson Counter Shift Registers Lecture L8.6v (Verilog) Section 8.3 Ring Counter Johnson Counter 4 ... – PowerPoint PPT presentation

Number of Views:234
Avg rating:3.0/5.0
Slides: 18
Provided by: oakl77
Category:
Tags: registers | shift

less

Transcript and Presenter's Notes

Title: Shift Registers


1
Shift Registers
  • Lecture L8.6v
  • (Verilog)
  • Section 8.3

2
4-Bit Shift Register
3
shift4.v
module ShiftReg(clk,clr,data_in,Q) input
clk input clr input data_in
output 30 Q reg 30 Q // 4-bit
Shift Register always _at_(posedge clk or posedge
clr) begin if(clr 1) Q lt 0
else begin Q3 lt data_in Q20 lt
Q31 end end endmodule
Note non-blocking assignment
4
shift4 simulation
5
Ring Counter
6
ring4.v
module ring4(clk,clr,Q) input clk
input clr output 30 Q reg 30
Q // 4-bit Ring Counter always _at_(posedge clk
or posedge clr) begin if(clr 1) Q lt
1 else begin Q3 lt Q0 Q20
lt Q31 end end endmodule
7
ring4 simulation
8
Johnson Counter
9
johnson4.v
module johnson4(clk,clr,Q) input clk
input clr output 30 Q reg 30
Q // 4-bit Johnson Counter always _at_(posedge
clk or posedge clr) begin if(clr 1) Q
lt 0 else begin Q3 lt Q0
Q20 lt Q31 end end endmodule
10
Johnson Counter
11
A Random Number Generator
12
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
13
rand4.v
module rand4(clk,clr,Q) input clk
input clr output 30 Q reg 30
Q // 4-bit Random number generator always
_at_(posedge clk or posedge clr) begin if(clr
1) Q lt 1 else begin Q3 lt Q3
Q0 Q20 lt Q31 end end endmodule
14
A Random Number Generator
15
Clock Pulse
16
clk_pulse.v
module clk_pulse(clk,clr,inp,outp) input
clk input clr input inp output
outp wire outp reg 20 Q //
clock pulse generator always _at_(posedge clk or
posedge clr) begin if(clr 1) Q lt 0
else begin Q2 lt inp Q10 lt
Q21 end end assign outp Q2 Q1
Q0 endmodule
17
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com