-
Notifications
You must be signed in to change notification settings - Fork 2
/
PC_tb.v
60 lines (51 loc) · 1.08 KB
/
PC_tb.v
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
52
53
54
55
56
57
58
59
60
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company: California State University San Bernardino
// Engineer: Bogdan Kravtsov
//
// Create Date: 13:46:10 10/03/2016
// Module Name: PC_tb
// Project Name: MIPS
// Description: Testing MIPS PC implementation in verilog.
//
// Dependencies: PC.v
//
////////////////////////////////////////////////////////////////////////////////
module PC_tb;
// Declare inputs.
reg [31:0] npc;
reg clk;
// Declare outputs.
wire [31:0] pcout;
// Instantiate the PC module.
PC pc (.clk(clk), .npc(npc), .PC(pcout));
initial begin
// Initialize inputs.
npc = 0;
clk = 0;
// Test values.
#20;
npc = npc + 1;
#20;
npc = npc + 1;
#20;
npc = npc + 1;
#20;
npc = npc + 1;
#20;
npc = npc + 1;
// Terminate.
#40 $finish;
end
// Display values.
always @ (posedge clk)
begin
$display("At t = %0d\tnpc = %h\t\tpc = %h", $time, npc, pcout);
end
// Clock.
initial begin
forever begin
#10 clk = ~clk;
end
end
endmodule