Skip to content
Snippets Groups Projects
Commit a863fcb6 authored by ks6n19's avatar ks6n19
Browse files

Update testbench/de0_wrapper.tcl

Deleted testbench/de0_wrapper_stim.sv, testbench/nexys4_wrapper.tcl, testbench/nexys4_wrapper_stim.sv, testbench/de2_wrapper_stim.sv files
parent 9ec03586
No related branches found
No related tags found
No related merge requests found
......@@ -9,14 +9,21 @@ simvision {
# Add Waves
waveform add -signals de0_wrapper_stim.CLOCK_50
waveform add -signals de0_wrapper_stim.KEY
waveform add -signals de0_wrapper_stim.SW
waveform add -signals de0_wrapper_stim.LEDG
waveform add -signals de0_wrapper_stim.HEX0
waveform add -signals de0_wrapper_stim.HEX1
waveform add -signals de0_wrapper_stim.HEX2
waveform add -signals de0_wrapper_stim.HEX3
waveform add -signals de1_soc_wrapper_stim.CLOCK_50
waveform add -signals de1_soc_wrapper_stim.SW
waveform add -signals de1_soc_wrapper_stim.LEDR
waveform add -signals de1_soc_wrapper_stim.HEX0
waveform add -signals de1_soc_wrapper_stim.HEX1
waveform add -signals de1_soc_wrapper_stim.HEX2
waveform add -signals de1_soc_wrapper_stim.HEX3
waveform add -signals de1_soc_wrapper_stim.KEY
waveform add -signals de1_soc_wrapper_stim.VGA_R
waveform add -signals de1_soc_wrapper_stim.VGA_G
waveform add -signals de1_soc_wrapper_stim.VGA_B
waveform add -signals de1_soc_wrapper_stim.VGA_HS
waveform add -signals de1_soc_wrapper_stim.VGA_VS
waveform add -signals de1_soc_wrapper_stim.VGA_CLK
waveform add -signals de1_soc_wrapper_stim.VGA_BLANK_N
waveform add -signals de0_wrapper_stim.dut.soc_inst.HADDR
waveform add -signals de0_wrapper_stim.dut.soc_inst.HWRITE
waveform add -signals de0_wrapper_stim.dut.soc_inst.HSEL_RAM
......
module de0_wrapper_stim();
timeunit 1ns;
timeprecision 100ps;
logic nReset, CLOCK_50;
logic [9:0] SW;
logic [1:0] Buttons;
wire [9:0] LEDG;
wire [7:0] HEX0;
wire [7:0] HEX1;
wire [7:0] HEX2;
wire [7:0] HEX3;
wire [2:0] KEY;
assign KEY={nReset,~Buttons[1:0]}; // de0 keys are active low
de0_wrapper dut(.CLOCK_50, .LEDG, .SW, .KEY, .HEX0, .HEX1, .HEX2, .HEX3);
always
begin
CLOCK_50 = 0;
#5ns CLOCK_50 = 1;
#10ns CLOCK_50 = 0;
#5ns CLOCK_50 = 0;
end
task press_button(input n);
#1us Buttons[n] = 1;
#1us Buttons[n] = 0;
endtask
initial
begin
nReset = 0;
Buttons = 0;
SW = 1;
#10.0ns nReset = 1;
#10us SW = 0;
#5us press_button(0);
#5us press_button(1);
#10us SW = 1;
#5us press_button(0);
#5us press_button(1);
#10us SW = 2;
#5us press_button(0);
#5us press_button(1);
#10us SW = 3;
#5us press_button(0);
#5us press_button(1);
#10us SW = 4;
#5us press_button(0);
#5us press_button(1);
#20us SW = 5;
#5us press_button(0);
#5us press_button(1);
#20us SW = 6;
#5us press_button(0);
#5us press_button(1);
#20us SW = 7;
#5us press_button(0);
#5us press_button(1);
#20us SW = 8;
#5us press_button(0);
#5us press_button(1);
#30us SW = 15;
#5us press_button(0);
#5us press_button(1);
#40us SW = 12;
#5us press_button(0);
#5us press_button(1);
#50us $stop;
$finish;
end
endmodule
module de2_wrapper_stim();
timeunit 1ns;
timeprecision 100ps;
logic nReset, CLOCK_50;
logic [15:0] SW;
logic [1:0] Buttons;
wire [15:0] LEDR;
wire [6:0] HEX0;
wire [6:0] HEX1;
wire [6:0] HEX2;
wire [6:0] HEX3;
wire [2:0] KEY;
assign KEY={nReset,~Buttons[1:0]}; // DE2 keys are active low
de2_wrapper dut(.CLOCK_50, .LEDR, .SW, .KEY, .HEX0, .HEX1, .HEX2, .HEX3);
always
begin
CLOCK_50 = 0;
#5ns CLOCK_50 = 1;
#10ns CLOCK_50 = 0;
#5ns CLOCK_50 = 0;
end
task press_button(input n);
#1us Buttons[n] = 1;
#1us Buttons[n] = 0;
endtask
initial
begin
nReset = 0;
Buttons = 0;
SW = 1;
#10.0ns nReset = 1;
#10us SW = 0;
#5us press_button(0);
#5us press_button(1);
#10us SW = 1;
#5us press_button(0);
#5us press_button(1);
#10us SW = 2;
#5us press_button(0);
#5us press_button(1);
#10us SW = 3;
#5us press_button(0);
#5us press_button(1);
#10us SW = 4;
#5us press_button(0);
#5us press_button(1);
#20us SW = 5;
#5us press_button(0);
#5us press_button(1);
#20us SW = 6;
#5us press_button(0);
#5us press_button(1);
#20us SW = 7;
#5us press_button(0);
#5us press_button(1);
#20us SW = 8;
#5us press_button(0);
#5us press_button(1);
#30us SW = 15;
#5us press_button(0);
#5us press_button(1);
#40us SW = 12;
#5us press_button(0);
#5us press_button(1);
#50us $stop;
$finish;
end
endmodule
# SimVision command script arm_soc.tcl
simvision {
# Open new waveform window
window new WaveWindow -name "Waves for ARM SoC Example"
waveform using "Waves for ARM SoC Example"
# Add Waves
waveform add -signals nexys4_wrapper_stim.Clock
waveform add -signals nexys4_wrapper_stim.nReset
waveform add -signals nexys4_wrapper_stim.Switches
waveform add -signals nexys4_wrapper_stim.Buttons
waveform add -signals nexys4_wrapper_stim.DataOut
waveform add -signals nexys4_wrapper_stim.DataValid
waveform add -signals nexys4_wrapper_stim.DataInvalid
waveform add -signals nexys4_wrapper_stim.Status_Green
waveform add -signals nexys4_wrapper_stim.Status_Red
waveform add -signals nexys4_wrapper_stim.dut.soc_inst.HADDR
waveform add -signals nexys4_wrapper_stim.dut.soc_inst.HWRITE
waveform add -signals nexys4_wrapper_stim.dut.soc_inst.HSEL_RAM
waveform add -signals nexys4_wrapper_stim.dut.soc_inst.HSEL_SW
waveform add -signals nexys4_wrapper_stim.dut.soc_inst.HSEL_DOUT
}
module nexys4_wrapper_stim();
timeunit 1ns;
timeprecision 100ps;
logic nReset, Clock;
logic [15:0] Switches;
logic [1:0] Buttons; // nexys4 buttons are active high
wire [15:0] DataOut;
wire DataValid, DataInvalid;
wire Status_Red, Status_Green;
nexys4_wrapper dut(.Clock, .nReset, .DataOut, .DataValid, .DataInvalid, .Switches, .Buttons, .Status_Red, .Status_Green);
always
begin
Clock = 0;
#2.5ns Clock = 1;
#5.0ns Clock = 0;
#2.5ns Clock = 0;
end
task press_button(input n);
#1us Buttons[n] = 1;
#1us Buttons[n] = 0;
endtask
initial
begin
nReset = 0;
Buttons = 0;
Switches = 1;
#10.0ns nReset = 1;
#10us Switches = 0;
#5us press_button(0);
#5us press_button(1);
#10us Switches = 1;
#5us press_button(0);
#5us press_button(1);
#10us Switches = 2;
#5us press_button(0);
#5us press_button(1);
#10us Switches = 3;
#5us press_button(0);
#5us press_button(1);
#10us Switches = 4;
#5us press_button(0);
#5us press_button(1);
#20us Switches = 5;
#5us press_button(0);
#5us press_button(1);
#20us Switches = 6;
#5us press_button(0);
#5us press_button(1);
#20us Switches = 7;
#5us press_button(0);
#5us press_button(1);
#20us Switches = 8;
#5us press_button(0);
#5us press_button(1);
#30us Switches = 15;
#5us press_button(0);
#5us press_button(1);
#40us Switches = 12;
#5us press_button(0);
#5us press_button(1);
#50us $stop;
$finish;
end
endmodule
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment