Verilog Lab 4
Verilog Lab 4
Verilog Lab 4
1
DESIGN
SYNCHRONOUS
SEQUENTIAL
SYNCHRONO
CIRCUIT
US
SEQUENTIAL
CIRCUIT
DO TRUNG
OVERVIEW BLOCK DIG RTL CODE TESTBENCH IMPLEMENT
2
1.OVERVIEW
OVERVIEW BLOCK DIG RTL CODE TESTBENCH IMPLEMENT
3
module Chiaxung_1hz
#(parameter N= 26)
( input wire clk, output wire q );
// signal declaration
3.TESTBENCH reg [N-1:0] r_reg;
initial
wire [N-1:0] r_next;
begin // body, register
clk = 0; always @(posedge clk)
end r_reg<=r_next;
// next state logic
always assign r_next = r_reg + 1;
begin // output logic
#10;
assign q=r_reg[0];
clk=~clk;
end endmodule
7
module Chiaxung_1hz
#(parameter N= 26)
( input wire clk, output wire q );
// signal declaration
3.IMPLEMENT reg [N-1:0] r_reg;
wire [N-1:0] r_next;
NET "clk" LOC = "C9" | // body, register
IOSTANDARD = LVCMOS33 ; always @(posedge clk)
NET "clk" r_reg<=r_next;
CLOCK_DEDICATED_ROUTE = // next state logic
FALSE; assign r_next = r_reg + 1;
NET "q" LOC = "C11" | // output logic
IOSTANDARD = LVTTL | assign q=r_reg[25];
SLEW = SLOW | DRIVE = 8; endmodule
9
1.BLOCK DIG
1.BLOCK DIG
OVERVIEW BLOCK DIG RTL CODE TESTBENCH IMPLEMENT
11
4. RTL CODE
module Chiaxung_1hz module Board_1Hz(
input wire clk_50m, reset,
#(parameter N= 26) output wire [3:0] led,
( input wire clk, output wire q ); output wire clk_1hz );
// signal declaration wire clk_i;
reg [N-1:0] r_reg; Chiaxung_1hz IC1(clk_50m, clk_i);
SynCounter_4b IC2(clk_i, reset, led);
wire [N-1:0] r_next; assign clk_1hz = clk_i;
// body, register endmodule
always @(posedge clk)
r_reg<=r_next;
// next state logic
assign r_next = r_reg + 1;
// output logic
assign q=r_reg[25];
endmodule
OVERVIEW BLOCK DIG RTL CODE TESTBENCH IMPLEMENT
13
5.IMPLEMENT
NET "clk_50m" LOC = "C9" | IOSTANDARD = LVCMOS33 ;
NET "clk_50m" CLOCK_DEDICATED_ROUTE = FALSE;
NET "reset" LOC = "L13" | IOSTANDARD = LVTTL | PULLUP ;
NET "led<0>" LOC = "F12" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "led<1>" LOC = "E12" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "led<2>" LOC = "E11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "led<3>" LOC = "F11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "clk_1hz" LOC = "F9" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
14
1.BLOCK DIG
OVERVIEW BLOCK DIG RTL CODE TESTBENCH IMPLEMENT
16
4. RTL CODE
module Chiaxung_1hz module Board_1Hz_Mod10(
input wire clk_50m, reset, ud,
#(parameter N= 26) output wire [3:0] led,
( input wire clk, output wire q ); output wire clk_1hz );
// signal declaration wire clk_i;
reg [N-1:0] r_reg; Chia_xung_c2 IC1(clk_50m, clk_i);
Counter_mod10_ud IC2(clk_i, reset,
wire [N-1:0] r_next; ud, led);
// body, register assign clk_1hz = clk_i;
always @(posedge clk) endmodule
r_reg<=r_next;
// next state logic
assign r_next = r_reg + 1;
// output logic
assign q=r_reg[25];
endmodule
OVERVIEW BLOCK DIG RTL CODE TESTBENCH IMPLEMENT
18
5.IMPLEMENT
NET "clk_50m" LOC = "C9" | IOSTANDARD = LVCMOS33 ;
NET "clk_50m" CLOCK_DEDICATED_ROUTE = FALSE;
NET "reset" LOC = "L13" | IOSTANDARD = LVTTL | PULLUP ;
NET "ud" LOC = "L14" | IOSTANDARD = LVTTL | PULLUP ;
NET "led<0>" LOC = "F12" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "led<1>" LOC = "E12" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "led<2>" LOC = "E11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "led<3>" LOC = "F11" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;
NET "clk_1hz" LOC = "F9" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8 ;