[verilog] tlc_controller_2.v
Viewer
- `default_nettype none
- module tlc_controller_ver2(
- output wire [1:0] highwaySignal, farmSignal, // outputs
- output wire [3:0] JB,
- input wire Clk, // inputs
- input wire Rst,
- input wire sensor
- );
- wire RstSync; // reset synchronizer
- wire RstCount; // reset count
- reg [30:0] Count; // count
- assign JB[3] = RstCount;
- synchronizer syncRst(RstSync, Rst, Clk); // synchronizer
- tlc_fsm_2 FSM(.state(JB[2:0]), // FSM
- .RstCount(RstCount),
- .highwaySignal(highwaySignal),
- .farmSignal(farmSignal),
- .Count(Count),
- .Clk(Clk),
- .Rst(Rst),
- .sensor(sensor));
- always@(posedge Clk) // clock
- if (RstCount)
- Count <= 0;
- else
- begin
- Count <= Count + 1;
- end
- endmodule
Editor
You can edit this paste and save as new: