Uploaded by Lybah Tariq

Digital System Design

advertisement
Question 01:
Draw the architectural model of 6-bit regular sequential circuit that performs the following
operation. Write Verilog code and include Modelsim Simulation results.
Ctrl - Operation
00 - Parallel load
01 - Shift left
10 - No change
11 - Complement of the output
Verilog Code:
Fig 1.1 verilog code of 6-bit regular sequential circuit
Fig 1.2verilog code of testbench of a 6-bit regular sequential circuit
Modelsim Simulation Results:
Fig 1.3when select line is 0 and at the first rising edge of clock, input is serial shifted left at
select line 1, the shifted input is serial shifted left once again, when select line is 3, the result is
complemented.
Fig 1.4architectural model of 6-bit regular sequential circuit
Question 02:
Draw the ASM charts for the following state transitions:
a. If x = 1, control goes from state S1 to state S2 ; if x = 0, generate mealy output m=1
and go from S1 to S3
b. If x = 1, control goes from state S1 to state S2 and then to S3; if x = 0, , control
goes from state S1 to state S3
c. Start from state S1 ; then if xy = 11, go to S2 ; if xy = 01 go to S3 ; and if xy =
10, go to S1 ; otherwise, go to S3
d. Start from state S1 ; then if xy = 11, go to S2 ; if xy = 01 go to S3 ; and if xy =
10, go to S1 ; otherwise, go to S3.
Fig 2.1part (a)
Fig 2.2 part (b)
Fig 2.3 part (c)
Fig 2.4 part (d)
Question 03:
A Tollbooth has the following components:
 A sensor on the driveway that shows presence of a car: Sensor output (S1) is 1 when a car is enters the
Tollbooth , S1=0 otherwise.
 A coin machine receiving the coin. When coin is inserted, coin machine output signal (C) is 1, otherwise
C=0 .
 Traffic light T and Barrier B: When a car enters the Tollbooth and coin is inserted in the coin machine,
traffic light is green (T=1) and the barrier B is open (B=1). Otherwise, traffic light is red (T=0)and the
barrier is closed(B=0).
 Exit sensor S2 : S2=1 shows that a car has left the tollbooth , S2=0 otherwise.
At normal times the tollbooth is idle. Traffic signal is red and the barrier is closed. When a car enters the
driveway of the booth, then the presence the car is detected with S1=1 from the sensor. The controller
then waits for the coin. When the coin is inserted, C=1, then the traffic light turn green i.e. T=1 and the
barrier is raised (B=1). When the car leaves i.e. when exit sensor S2=1, the system moves to idle state.
Assume there is room for one car only at the booth.
a. Draw State diagram ASM chart of the design
b. Write the Verilog HDL code for the design and include Modelsim simulation results.
Fig 3.1 part (a)
Fig 3.2 part (b) modelsim code
Fig 3.3 code extended
Fig 3.3 part (b) code test bench
Fig 3.4 result: we see that when sensor 2 is High, traffic light and barrier turns High as well.
Download