`timescale 100ps / 10ps //stimulus file for an "up only" counter module count_stim; reg Up, nReset, Clock; wire [3:0] Count; count instance1 ( Count, Up, Clock, nReset ); always begin Clock = 0; #250 Clock = 1; #500 Clock = 0; #250 Clock = 0; end initial begin nReset = 1; Up = 0; #1000 nReset = 0; #1000 nReset = 1; #1000 Up = 1; #5000 Up = 0; #2000 Up = 1; #17000 Up = 0; #3000 $stop; $finish; end initial begin $timeformat(-10); $gr_position( "waves", 20,20,1000,320); $gr_waves( "Clock", Clock, "nReset", nReset, "Up", Up, "Count_3", Count[3], "Count_2", Count[2], "Count_1", Count[1], "Count_0", Count[0], "Count %d", Count ); $gr_position( "regs", 20,380,400,200); $gr_regs( "Register Window For UP ONLY Counter", "===================================", " Direction of count %s", direction(Up), " Count (binary) %b", Count, " Count (decimal) %d", Count, " Count (hexadecimal) %h", Count ); end wire [6*8:1] directStr; assign directStr = direction(Up); //VSIM COMMAND: add wave -label "Clock" Clock -label "nReset" nReset //VSIM COMMAND: add wave -label "Up" Up //VSIM COMMAND: add wave -label "Count" -unsigned -expand Count //VSIM COMMAND: view list -x 0 -width 400 //VSIM COMMAND: add list -label "Direction of count" -ascii directStr //VSIM COMMAND: add list -label "Count (hexadecimal)" -hexadecimal Count //VSIM COMMAND: add list -label "Count (decimal)" -unsigned Count //VSIM COMMAND: add list -label "Count (binary)" -binary Count //VSIM COMMAND: run -all function [6*8:1] direction; input up; if (up == 1) direction = "Up"; else direction = "Hold"; endfunction endmodule