Dsd Lab Report 12
Dsd Lab Report 12
CONTROLLER USING
FSM
LAB # 12
Spring 2024
CSE-308L
Digital System Design Lab
Class Section: B
Student Signature:
Submitted to:
Objectives:
➢ Continue the introduction to FSMs
➢ Mealy machine
Lab Tasks:
Task 1:
D < 3 sec
V=0 HG_FR V=1 HR_FY
D = 3 sec
D = 3 sec
HY_FR HR_FG
Verilog Code:
module Traffic_lights(clk,rst,v,out_farm,out_highway);
input clk,rst,v;
output reg [2:0] out_farm, out_highway;
reg [1:0] PS,NS;
parameter [1:0] FR_HG = 0, FY_HR = 1, FG_HR = 2, FR_HY = 3;
parameter [2:0] red = 100, yellow = 010, green = 001;
wire out_clk;
clk_divider d1(clk,out_clk,rst);
FY_HR:
begin
NS = FG_HR;
out_highway = red;
out_farm = green;
end
FG_HR:
begin
NS = FR_HY;
out_highway = yellow;
out_farm = red;
end
FR_HY:
begin
NS = FR_HG;
out_highway = green;
out_farm = red;
end
endcase
endmodule
UCF file:
net "rst" LOC =K18 | IOSTANDARD = LVCMOS33 | DRIVE = 8 | SLEW = FAST
| PULLUP;
net "v" LOC =F17 | IOSTANDARD = LVCMOS33 | DRIVE = 8 | SLEW = FAST |
PULLUP;
net "clk" LOC =V10 | IOSTANDARD = LVCMOS33 | period = 100MHz;
Output:
References:
➢ To view my lab codes, please refer to the DCSE repository on my GitHub Account:
https://github.com/aimalexe/DCSE/tree/main/semester_6_(spring-
24)/digital_system_design_lab/lab_reports
➢ And so on…
➢
Conclusion:
In summary, our Digital Systems Design lab has been a success, enabling us to
achieve our objectives through hands-on tasks and theoretical exploration. This experience
has enhanced my understanding of fundamental concepts in Verilog and their practical
applications. I am excited to apply this knowledge in various contexts moving forward.
The End.