Académique Documents
Professionnel Documents
Culture Documents
the circuit turns on a LED. In response to the LED being turned on, the person attempts to press a switch as quickly as possible. The circuit measures the elapsed time from when the LED is turned on until the switch is pressed.
Specifications
Available clock: 102.4 kHz Resolution of time measurement: 1/100 second Two-digit BCD display: 00/100 to 99/100 second Assume that a signal w is used to turn on the LED. Push-button switch is depressed by a person to generate a signal to turn off the LED. A counter will count the time between turn-on and turn-off.
100 Hz clock
100 Hz c9 c1 c0
10-bit counter
LEDn pushn
Digit1
Digit0
c9
reset
seg7
BCD code
Combinational circuit
pushn
always @(posedge c9) begin if (Pushn == 0) LED <= 0; else if (w) LED <= 1; end assign LEDn = ~LED; BCDcount counter (c9, Reset, LED, BCD1, BCD0); seg7 seg1 (BCD1, Digit1); seg7 seg0 (BCD0, Digit0); endmodule
Simulation
W (rising)LED on counting Person pushed the button stop counting LED off Display the elapsed time (result of counting)
a f e d
b c
Ring counter
D Q
D Q
q0
clock
q1
D Q
q2
quiz
module lfsr2(r,L,clock,q); input [0:2] r; input L, clock; output [0:2] q; reg [0:2] q;
always @ (posedge clock) if(L) q <= r; else q <= {q[2], q[0], q[1]^q[2]}; endmodule
1. Draw the circuit using D-flip flips, multiplexers, and xor gate(s) 2. What is the sequence after loading r=001?