1 |
3 |
gdevic |
//==============================================================
|
2 |
|
|
// Test PLA decode and combinatorial static execute
|
3 |
|
|
//==============================================================
|
4 |
|
|
`timescale 100 ns/ 100 ns
|
5 |
|
|
|
6 |
|
|
module test_decode;
|
7 |
|
|
|
8 |
|
|
reg [7:0] ir_sig;
|
9 |
|
|
reg [4:0] prefix_sig;
|
10 |
|
|
wire [107:0] pla_sig;
|
11 |
|
|
|
12 |
|
|
// ----------------- TEST -------------------
|
13 |
|
|
initial begin
|
14 |
|
|
integer opcode;
|
15 |
|
|
|
16 |
|
|
// Test every opcode in the first table
|
17 |
|
|
|
18 |
|
|
//================================================
|
19 |
|
|
// Regular instructions with no prefix
|
20 |
|
|
//================================================
|
21 |
|
|
$display("START IXY0:XX");
|
22 |
|
|
opcode = 0;
|
23 |
|
|
while(opcode<256) begin
|
24 |
|
|
#1 $display("OPCODE: 0x%2H", opcode);
|
25 |
|
|
prefix_sig[4:0] = 5'b10100;
|
26 |
|
|
ir_sig[7:0] = opcode;
|
27 |
|
|
#1 // Reset the IR into NOP so we get the trigger signal again
|
28 |
|
|
prefix_sig[4:0] = 5'b01100;
|
29 |
|
|
ir_sig[7:0] = 0;
|
30 |
|
|
opcode++;
|
31 |
|
|
end
|
32 |
|
|
#1 $display("END");
|
33 |
|
|
|
34 |
|
|
//================================================
|
35 |
|
|
// Regular instructions with IX/IY prefix
|
36 |
|
|
//================================================
|
37 |
|
|
$display("START IXY1:XX");
|
38 |
|
|
opcode = 0;
|
39 |
|
|
while(opcode<256) begin
|
40 |
|
|
#1 $display("OPCODE: 0x%2H", opcode);
|
41 |
|
|
prefix_sig[4:0] = 5'b01100;
|
42 |
|
|
ir_sig[7:0] = opcode;
|
43 |
|
|
#1 // Reset the IR into NOP so we get the trigger signal again
|
44 |
|
|
prefix_sig[4:0] = 5'b01100;
|
45 |
|
|
ir_sig[7:0] = 0;
|
46 |
|
|
opcode++;
|
47 |
|
|
end
|
48 |
|
|
#1 $display("END");
|
49 |
|
|
|
50 |
|
|
//================================================
|
51 |
|
|
// CD instructions with no prefix
|
52 |
|
|
//================================================
|
53 |
|
|
$display("START IXY0:CB");
|
54 |
|
|
opcode = 0;
|
55 |
|
|
while(opcode<256) begin
|
56 |
|
|
#1 $display("OPCODE: 0x%2H", opcode);
|
57 |
|
|
prefix_sig[4:0] = 5'b10010;
|
58 |
|
|
ir_sig[7:0] = opcode;
|
59 |
|
|
#1 // Reset the IR into NOP so we get the trigger signal again
|
60 |
|
|
prefix_sig[4:0] = 5'b01100;
|
61 |
|
|
ir_sig[7:0] = 0;
|
62 |
|
|
opcode++;
|
63 |
|
|
end
|
64 |
|
|
#1 $display("END");
|
65 |
|
|
|
66 |
|
|
//================================================
|
67 |
|
|
// CB instructions with IX/IY prefix
|
68 |
|
|
//================================================
|
69 |
|
|
$display("START IXY1:CB");
|
70 |
|
|
opcode = 0;
|
71 |
|
|
while(opcode<256) begin
|
72 |
|
|
#1 $display("OPCODE: 0x%2H", opcode);
|
73 |
|
|
prefix_sig[4:0] = 5'b01010;
|
74 |
|
|
ir_sig[7:0] = opcode;
|
75 |
|
|
#1 // Reset the IR into NOP so we get the trigger signal again
|
76 |
|
|
prefix_sig[4:0] = 5'b01100;
|
77 |
|
|
ir_sig[7:0] = 0;
|
78 |
|
|
opcode++;
|
79 |
|
|
end
|
80 |
|
|
#1 $display("END");
|
81 |
|
|
|
82 |
|
|
//================================================
|
83 |
|
|
// ED instructions with no prefix
|
84 |
|
|
//================================================
|
85 |
|
|
$display("START IXY0:ED");
|
86 |
|
|
opcode = 0;
|
87 |
|
|
while(opcode<256) begin
|
88 |
|
|
#1 $display("OPCODE: 0x%2H", opcode);
|
89 |
|
|
prefix_sig[4:0] = 5'b10001;
|
90 |
|
|
ir_sig[7:0] = opcode;
|
91 |
|
|
#1 // Reset the IR into NOP so we get the trigger signal again
|
92 |
|
|
prefix_sig[4:0] = 5'b01100;
|
93 |
|
|
ir_sig[7:0] = 0;
|
94 |
|
|
opcode++;
|
95 |
|
|
end
|
96 |
|
|
#1 $display("END");
|
97 |
|
|
|
98 |
|
|
//================================================
|
99 |
|
|
// ED instructions with IX/IY prefix
|
100 |
|
|
//================================================
|
101 |
|
|
$display("START IXY1:ED");
|
102 |
|
|
opcode = 0;
|
103 |
|
|
while(opcode<256) begin
|
104 |
|
|
#1 $display("OPCODE: 0x%2H", opcode);
|
105 |
|
|
prefix_sig[4:0] = 5'b01001;
|
106 |
|
|
ir_sig[7:0] = opcode;
|
107 |
|
|
#1 // Reset the IR into NOP so we get the trigger signal again
|
108 |
|
|
prefix_sig[4:0] = 5'b01001;
|
109 |
|
|
ir_sig[7:0] = 0;
|
110 |
|
|
opcode++;
|
111 |
|
|
end
|
112 |
|
|
#1 $display("END");
|
113 |
|
|
|
114 |
|
|
end
|
115 |
|
|
|
116 |
|
|
//--------------------------------------------------------------
|
117 |
|
|
// Instantiate decode blocks
|
118 |
|
|
//--------------------------------------------------------------
|
119 |
|
|
|
120 |
|
|
pla_decode pla_decode_inst
|
121 |
|
|
(
|
122 |
|
|
.prefix(prefix_sig) , // input [6:0] prefix_sig
|
123 |
|
|
.opcode(ir_sig) , // input [7:0] opcode
|
124 |
|
|
.pla(pla_sig) // output [104:0] pla_sig
|
125 |
|
|
);
|
126 |
|
|
|
127 |
|
|
execute execute_inst
|
128 |
|
|
(
|
129 |
|
|
.pla(pla_sig) , // input [107:0] pla_sig
|
130 |
|
|
.M1(M1_sig) , // input M1_sig
|
131 |
|
|
.M2(M2_sig) , // input M2_sig
|
132 |
|
|
.M3(M3_sig) , // input M3_sig
|
133 |
|
|
.M4(M4_sig) , // input M4_sig
|
134 |
|
|
.M5(M5_sig) , // input M5_sig
|
135 |
|
|
.T1(T1_sig) , // input T1_sig
|
136 |
|
|
.T2(T2_sig) , // input T2_sig
|
137 |
|
|
.T3(T3_sig) , // input T3_sig
|
138 |
|
|
.T4(T4_sig) , // input T4_sig
|
139 |
|
|
.T5(T5_sig) , // input T5_sig
|
140 |
|
|
.T6(T6_sig) , // input T6_sig
|
141 |
|
|
.nextM(nextM_sig) , // output nextM_sig
|
142 |
|
|
.setM1(setM1_sig) , // output setM1_sig
|
143 |
|
|
.setM1ss(setM1ss_sig) , // output setM1ss_sig
|
144 |
|
|
.setM1cc(setM1cc_sig) , // output setM1cc_sig
|
145 |
|
|
.setM1bz(setM1bz_sig) , // output setM1bz_sig
|
146 |
|
|
.fFetch(fFetch_sig) , // output fFetch_sig
|
147 |
|
|
.fMRead(fMRead_sig) , // output fMRead_sig
|
148 |
|
|
.fMWrite(fMWrite_sig) , // output fMWrite_sig
|
149 |
|
|
.fIORead(fIORead_sig) , // output fIORead_sig
|
150 |
|
|
.fIOWrite(fIOWrite_sig) , // output fIOWrite_sig
|
151 |
|
|
.FIntr(FIntr_sig) , // output FIntr_sig
|
152 |
|
|
.ctl_bus_sw1(ctl_bus_sw1_sig) , // output ctl_bus_sw1_sig
|
153 |
|
|
.ctl_bus_sw2(ctl_bus_sw2_sig) , // output ctl_bus_sw2_sig
|
154 |
|
|
.ctl_bus_sw4(ctl_bus_sw4_sig) , // output ctl_bus_sw4_sig
|
155 |
|
|
.ctl_al_we(ctl_al_we_sig) , // output ctl_al_we_sig
|
156 |
|
|
.ctl_inc_dec(ctl_inc_dec_sig) , // output ctl_inc_dec_sig
|
157 |
|
|
.ctl_inc_limit6(ctl_inc_limit6_sig) , // output ctl_inc_limit6_sig
|
158 |
|
|
.ctl_inc_cy(ctl_inc_cy_sig) , // output ctl_inc_cy_sig
|
159 |
|
|
.ctl_ab_mux_inc(ctl_ab_mux_inc_sig) , // output ctl_ab_mux_inc_sig
|
160 |
|
|
.explode(explode_sig) // output explode_sig
|
161 |
|
|
);
|
162 |
|
|
|
163 |
|
|
endmodule
|