-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestROM.sv
51 lines (42 loc) · 899 Bytes
/
testROM.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//TCES330 Spring 2022
//Week 8 Thursday
//example testing 1-port ROM module
//from the IP-catalog
`timescale 1ns/1ns
module testROM();
logic [6:0]addr;
logic Clk;
logic [15:0]Dout;
myROM1 unit0 (
.address(addr),
.clock(Clk),
.q(Dout));
always begin
Clk = 0; #10;
Clk = 1; #10;
end
initial begin
for (int k=0; k<6; k++) begin
addr = k;
#20; //notice I use #20 here so the change happens at the falling edge of clk
$display($time,,,Dout);
end
$stop;
end
// this segment of the code as testing
// can verify how many clock cycles
// it will take to read the instruction
// memory
/*initial begin
@(negedge Clk)
addr = 7'd0;
@(posedge Clk)
$display($time,,,Dout);
@(posedge Clk)
$display($time,,,Dout);
@(posedge Clk)
$display($time,,,Dout);
$stop;
end
*/
endmodule