URL
https://opencores.org/ocsvn/a-z80/a-z80/trunk
[/] [a-z80/] [trunk/] [cpu/] [control/] [test_reset.sv] - Blame information for rev 7
Go to most recent revision |
Details |
Compare with Previous |
View Log
| Line No. |
Rev |
Author |
Line |
| 1 |
3 |
gdevic |
//==============================================================
|
| 2 |
|
|
// Test reset circuit
|
| 3 |
|
|
//==============================================================
|
| 4 |
|
|
`timescale 100 ns/ 100 ns
|
| 5 |
|
|
|
| 6 |
|
|
module test_reset;
|
| 7 |
|
|
|
| 8 |
|
|
// ----------------- CLOCKS AND RESET -----------------
|
| 9 |
|
|
`define T #2
|
| 10 |
|
|
bit clk = 1;
|
| 11 |
|
|
initial repeat (30) #1 clk = ~clk;
|
| 12 |
|
|
|
| 13 |
|
|
// Specific to FPGA, some modules in the schematic need to be pre-initialized
|
| 14 |
|
|
reg fpga_reset = 1;
|
| 15 |
|
|
always_latch
|
| 16 |
|
|
if (clk) fpga_reset <= 0;
|
| 17 |
|
|
|
| 18 |
|
|
//----------------------------------------------------------
|
| 19 |
|
|
// Input reset from the pin; state from the sequencer
|
| 20 |
|
|
//----------------------------------------------------------
|
| 21 |
|
|
logic reset_in = 0;
|
| 22 |
|
|
logic M1 = 0;
|
| 23 |
|
|
logic T2 = 0;
|
| 24 |
|
|
|
| 25 |
|
|
wire clrpc; // Load 0 to PC
|
| 26 |
|
|
wire nreset; // Internal inverted reset signal
|
| 27 |
|
|
|
| 28 |
|
|
// ----------------- TEST -------------------
|
| 29 |
|
|
initial begin
|
| 30 |
|
|
// Test normal reset sequence - 3 clocks long
|
| 31 |
|
|
`T reset_in = 1;
|
| 32 |
|
|
`T `T `T reset_in = 0;
|
| 33 |
|
|
`T assert(nreset==0 && clrpc==0);
|
| 34 |
|
|
// Test special reset sequence: a reset pin is briefly
|
| 35 |
|
|
// asserted at M1/T1 and CLRPC should hold until the next
|
| 36 |
|
|
// M1/T2
|
| 37 |
|
|
`T reset_in = 1; M1=1;
|
| 38 |
|
|
`T reset_in = 0; M1=1; T2=1;
|
| 39 |
|
|
`T M1=1; T2=0;
|
| 40 |
|
|
`T `T
|
| 41 |
|
|
`T assert(nreset==1 && clrpc==1);
|
| 42 |
|
|
`T M1=1; T2=1;
|
| 43 |
|
|
`T M1=1; T2=0;
|
| 44 |
|
|
`T assert(nreset==1 && clrpc==0);
|
| 45 |
|
|
|
| 46 |
|
|
`T $display("End of test");
|
| 47 |
|
|
end
|
| 48 |
|
|
|
| 49 |
|
|
//--------------------------------------------------------------
|
| 50 |
|
|
// Instantiate DUT
|
| 51 |
|
|
//--------------------------------------------------------------
|
| 52 |
|
|
|
| 53 |
|
|
resets reset_block ( .* );
|
| 54 |
|
|
|
| 55 |
|
|
endmodule
|
| 56 |
|
|
|
© copyright 1999-2026
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.