1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-17 20:02:53 +08:00
oh/common/dv/dv_ctrl.v
Andreas Olofsson 8d6c07be9b Changing timeout
- Test being cut off too early.
- Really need to implement end of test indication already!!!
2016-01-13 15:32:15 -05:00

65 lines
1.2 KiB
Verilog

/* verilator lint_off STMTDLY */
module dv_ctrl(/*AUTOARG*/
// Outputs
nreset, clk, start,
// Inputs
dut_active, stim_done, test_done
);
parameter CLK_PERIOD = 10;
parameter CLK_PHASE = CLK_PERIOD/2;
parameter TIMEOUT = 5000;
output nreset; // async active low reset
output clk; // main clock
output start; // start test (level)
input dut_active; // reset sequence is done
input stim_done; //stimulus is done
input test_done; //test is done
//signal declarations
reg nreset;
reg start;
reg clk=0;
//RESET
initial
begin
#(1)
nreset = 'b0;
#(CLK_PERIOD*20) //hold reset for 20 cycles
nreset = 'b1;
end
//START TEST
always @ (posedge clk or negedge nreset)
if(!nreset)
start = 1'b0;
else if(dut_active)
start = 1'b1;
//STOP SIMULATION
always @ (posedge clk)
if(stim_done & test_done)
#(TIMEOUT) $finish;
//CLOCK GENERATOR
always
#(CLK_PHASE) clk = ~clk;
//WAVEFORM DUMP
//Better solution?
`ifndef VERILATOR
initial
begin
$dumpfile("waveform.vcd");
$dumpvars(0, dv_top);
end
`endif
endmodule // dv_ctrl