OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [cpu/] [control/] [test_reset.sv] - Blame information for rev 8

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 8 gdevic
initial repeat (40) #1 clk = ~clk;
12 3 gdevic
 
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 8 gdevic
    `T assert(nreset==0);
34
    // Out of the reset for several more cycles
35
    // Check that the clrpc is set for the next 2 1/2 cycles (see waveform)
36
    `T assert(nreset==1 && clrpc==1);
37
    `T assert(nreset==1 && clrpc==1);
38
    `T assert(nreset==1 && clrpc==0);
39
    `T assert(nreset==1 && clrpc==0);
40
    `T assert(nreset==1 && clrpc==0);
41
 
42 3 gdevic
    // Test special reset sequence: a reset pin is briefly
43
    // asserted at M1/T1 and CLRPC should hold until the next
44
    // M1/T2
45
    `T reset_in = 1; M1=1;
46
    `T reset_in = 0; M1=1; T2=1;
47
    `T               M1=1; T2=0;
48
    `T `T
49
    `T assert(nreset==1 && clrpc==1);
50
    `T               M1=1; T2=1;
51
    `T               M1=1; T2=0;
52
    `T assert(nreset==1 && clrpc==0);
53
 
54
    `T $display("End of test");
55
end
56
 
57
//--------------------------------------------------------------
58
// Instantiate DUT
59
//--------------------------------------------------------------
60
 
61
resets reset_block ( .* );
62
 
63
endmodule
64
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.