File size: 1,642 Bytes
78c261f | 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 61 62 63 | module pc_control_tb();
reg [1:0]instr_type;
reg [4:0] opcode;
reg zero_signal;
reg stop_bit;
wire [1:0] pc_src;
pc_control pc_control_0(instr_type, opcode, zero_signal, stop_bit, pc_src);
initial begin
$monitor("instr_type = %b, opcode = %b, zero_signal = %b, stop_bit = %b, pc_src = %b",instr_type, opcode, zero_signal, stop_bit, pc_src);
instr_type = 2'b00;
opcode = 5'b00000;
zero_signal = 0;
stop_bit = 0;
#10;
instr_type = 2'b00;
opcode = 5'b00000;
zero_signal = 0;
stop_bit = 1;
#10;
instr_type = 2'b00;
opcode = 5'b00000;
zero_signal = 1;
stop_bit = 0;
#10;
instr_type = 2'b01;
opcode = 5'b00001;
zero_signal = 0;
stop_bit = 0;
#10;
instr_type = 2'b01;
opcode = 5'b00010;
zero_signal = 0;
stop_bit = 1;
#10;
instr_type = 2'b01;
opcode = 5'b00100; // BEQ instruction
zero_signal = 1;
stop_bit = 0;
#10;
instr_type = 2'b10;
opcode = 5'b00100;
zero_signal = 1;
stop_bit = 0;
#10;
instr_type = 2'b10;
opcode = 5'b00010;
zero_signal = 0;
stop_bit = 0;
#10;
instr_type = 2'b11;
opcode = 5'b00010;
zero_signal = 0;
stop_bit = 0;
#10;
instr_type = 2'b11;
opcode = 5'b00010;
zero_signal = 0;
stop_bit = 1;
#10;
#30 $finish;
end
endmodule |