2 use ieee.std_logic_1164.all;
3 use ieee.std_logic_arith.conv_std_logic_vector;
4 use ieee.std_logic_unsigned.conv_integer;
5 use work.motonesfpga_common.all;
8 generic (dsize : integer := 8);
11 set_clk : in std_logic;
12 trig_clk : in std_logic;
17 instruction : in std_logic_vector (dsize - 1 downto 0);
18 exec_cycle : in std_logic_vector (5 downto 0);
19 next_cycle : out std_logic_vector (5 downto 0);
20 ea_carry : in std_logic;
21 status_reg : inout std_logic_vector (dsize - 1 downto 0);
24 inst_we_n : out std_logic;
25 ad_oe_n : out std_logic;
26 dbuf_int_oe_n : out std_logic;
29 ----control line for dual port registers.
30 idl_l_cmd : out std_logic_vector(3 downto 0);
31 idl_h_cmd : out std_logic_vector(3 downto 0);
32 pcl_cmd : out std_logic_vector(3 downto 0);
33 pch_cmd : out std_logic_vector(3 downto 0);
34 sp_cmd : out std_logic_vector(3 downto 0);
35 x_cmd : out std_logic_vector(3 downto 0);
36 y_cmd : out std_logic_vector(3 downto 0);
37 acc_cmd : out std_logic_vector(3 downto 0);
40 pcl_inc_n : out std_logic;
41 sp_oe_n : out std_logic;
42 sp_push_n : out std_logic;
43 sp_pop_n : out std_logic;
44 abs_xy_n : out std_logic;
45 pg_next_n : out std_logic;
47 zp_xy_n : out std_logic;
48 rel_calc_n : out std_logic;
49 indir_n : out std_logic;
50 indir_x_n : out std_logic;
51 indir_y_n : out std_logic;
54 stat_dec_oe_n : out std_logic;
55 stat_bus_oe_n : out std_logic;
56 stat_set_flg_n : out std_logic;
57 stat_flg : out std_logic;
58 stat_bus_all_n : out std_logic;
59 stat_bus_nz_n : out std_logic;
60 stat_alu_we_n : out std_logic;
63 arith_en_n : out std_logic;
66 r_vec_oe_n : out std_logic;
67 n_vec_oe_n : out std_logic;
68 i_vec_oe_n : out std_logic
70 ;---for parameter check purpose!!!
71 check_bit : out std_logic_vector(1 to 5)
75 architecture rtl of decoder is
77 component d_flip_flop_bit
89 -- bit 5 : pcl increment carry flag
90 -- bit 4,3 : cycle type: 00 normal, 01 reset , 10 nmi, 11 irq
93 --00xxx : exec cycle : T0 > T1 > T2 > T3 > T4 > T5 > T6 > T0
94 constant T0 : std_logic_vector (5 downto 0) := "000000";
95 constant T1 : std_logic_vector (5 downto 0) := "000001";
96 constant T2 : std_logic_vector (5 downto 0) := "000010";
97 constant T3 : std_logic_vector (5 downto 0) := "000011";
98 constant T4 : std_logic_vector (5 downto 0) := "000100";
99 constant T5 : std_logic_vector (5 downto 0) := "000101";
100 constant T6 : std_logic_vector (5 downto 0) := "000110";
102 --01xxx : reset cycle : R0 > R1 > R2 > R3 > R4 > R5 > T0
103 constant R0 : std_logic_vector (5 downto 0) := "001000";
104 constant R1 : std_logic_vector (5 downto 0) := "001001";
105 constant R2 : std_logic_vector (5 downto 0) := "001010";
106 constant R3 : std_logic_vector (5 downto 0) := "001011";
107 constant R4 : std_logic_vector (5 downto 0) := "001100";
108 constant R5 : std_logic_vector (5 downto 0) := "001101";
110 --10xxx : nmi cycle : T0 > N1 > N2 > N3 > N4 > N5 > T0
111 constant N1 : std_logic_vector (5 downto 0) := "010001";
112 constant N2 : std_logic_vector (5 downto 0) := "010010";
113 constant N3 : std_logic_vector (5 downto 0) := "010011";
114 constant N4 : std_logic_vector (5 downto 0) := "010100";
115 constant N5 : std_logic_vector (5 downto 0) := "010101";
117 --11xxx : irq cycle : T0 > I1 > I2 > I3 > I4 > I5 > T0
118 constant I1 : std_logic_vector (5 downto 0) := "011001";
119 constant I2 : std_logic_vector (5 downto 0) := "011010";
120 constant I3 : std_logic_vector (5 downto 0) := "011011";
121 constant I4 : std_logic_vector (5 downto 0) := "011100";
122 constant I5 : std_logic_vector (5 downto 0) := "011101";
124 constant ERROR_CYCLE : std_logic_vector (5 downto 0) := "111111";
126 -- SR Flags (bit 7 to bit 0):
131 -- 3 D .... Decimal (use BCD for arithmetics)
132 -- 2 I .... Interrupt (IRQ disable)
135 constant st_N : integer := 7;
136 constant st_V : integer := 6;
137 constant st_B : integer := 4;
138 constant st_D : integer := 3;
139 constant st_I : integer := 2;
140 constant st_Z : integer := 1;
141 constant st_C : integer := 0;
144 signal nmi_handled_n : std_logic;
146 signal ea_carry_reg : std_logic;
150 ea_carry_inst: d_flip_flop_bit
151 port map(trig_clk, '1', '1', '0', ea_carry, ea_carry_reg);
153 main_p : process (set_clk, res_n, nmi_n)
155 -------------------------------------------------------------
156 -------------------------------------------------------------
157 ----------------------- comon routines ----------------------
158 -------------------------------------------------------------
159 -------------------------------------------------------------
161 ----------gate_cmd format
162 ------3 : front port oe_n
163 ------2 : front port we_n
164 ------1 : back port oe_n
165 ------0 : back port we_n
166 procedure front_oe (signal cmd : out std_logic_vector(3 downto 0);
167 val : in std_logic) is
171 procedure front_we (signal cmd : out std_logic_vector(3 downto 0);
172 val : in std_logic) is
176 procedure back_oe (signal cmd : out std_logic_vector(3 downto 0);
177 val : in std_logic) is
181 procedure back_we (signal cmd : out std_logic_vector(3 downto 0);
182 val : in std_logic) is
187 procedure fetch_next is
190 back_oe(pcl_cmd, '0');
191 back_oe(pch_cmd, '0');
192 back_we(pcl_cmd, '0');
193 back_we(pch_cmd, '1');
196 procedure fetch_stop is
199 back_oe(pcl_cmd, '1');
200 back_oe(pch_cmd, '1');
201 back_we(pcl_cmd, '1');
205 procedure read_status is
207 status_reg <= (others => 'Z');
208 stat_dec_oe_n <= '0';
211 procedure disable_pins is
213 --following pins are not set in this function.
214 -- inst_we_n : out std_logic;
215 -- ad_oe_n : out std_logic;
216 -- dl_al_oe_n : out std_logic;
217 -- pcl_inc_n : out std_logic;
218 -- pcl_cmd : out std_logic_vector(3 downto 0);
219 -- pch_cmd : out std_logic_vector(3 downto 0);
220 -- r_nw : out std_logic
222 --disable the last opration pins.
223 dbuf_int_oe_n <= '1';
248 stat_bus_oe_n <= '1';
249 stat_set_flg_n <= '1';
251 stat_bus_all_n <= '1';
252 stat_bus_nz_n <= '1';
253 stat_alu_we_n <= '1';
261 procedure fetch_inst is
263 if instruction = conv_std_logic_vector(16#4c#, dsize) then
264 --if prior cycle is jump instruction,
265 --fetch opcode from where the latch is pointing to.
271 --fetch opcode and pcl increment.
282 d_print(string'("fetch 1"));
286 ---(along with the page boundary condition, the last
287 ---cycle is bypassed and slided to T0.)
288 procedure t0_cycle is
291 if (nmi_n = '0' and nmi_handled_n = '1') then
292 --start nmi handling...
301 ---common routine for single byte instruction.
302 procedure single_inst is
308 procedure fetch_imm is
310 d_print("immediate");
312 --send data from data bus buffer.
313 --receiver is instruction dependent.
314 dbuf_int_oe_n <= '0';
318 procedure set_nz_from_bus is
320 --status register n/z bit update.
321 stat_bus_nz_n <= '0';
324 procedure set_zc_from_alu is
326 --status register n/z bit update.
327 stat_alu_we_n <= '0';
328 stat_dec_oe_n <= '1';
329 status_reg <= "00000011";
332 procedure set_nz_from_alu is
334 --status register n/z/c bit update.
335 stat_alu_we_n <= '0';
336 stat_dec_oe_n <= '1';
337 status_reg <= "10000010";
340 procedure set_nzc_from_alu is
342 --status register n/z/c bit update.
343 stat_alu_we_n <= '0';
344 stat_dec_oe_n <= '1';
345 status_reg <= "10000011";
348 procedure set_nvz_from_alu is
350 --status register n/z/v bit update.
351 stat_alu_we_n <= '0';
352 stat_dec_oe_n <= '1';
353 status_reg <= "11000010";
356 procedure set_nvzc_from_alu is
358 stat_alu_we_n <= '0';
359 stat_dec_oe_n <= '1';
360 status_reg <= "11000011";
363 --flag on/off instruction
364 procedure set_flag (int_flg : in integer; val : in std_logic) is
366 stat_dec_oe_n <= '1';
367 stat_set_flg_n <= '0';
368 --specify which to set.
369 status_reg(7 downto int_flg + 1)
371 status_reg(int_flg - 1 downto 0)
373 status_reg(int_flg) <= '1';
378 procedure set_flag0 (val : in std_logic) is
380 stat_dec_oe_n <= '1';
381 stat_set_flg_n <= '0';
382 status_reg <= "00000001";
386 procedure fetch_low is
388 d_print("fetch low 2");
389 --fetch next opcode (abs low).
391 --latch abs low data.
392 dbuf_int_oe_n <= '0';
397 procedure abs_fetch_high is
399 d_print("abs (xy) 3");
404 dbuf_int_oe_n <= '0';
409 procedure abs_latch_out is
420 procedure ea_x_out is
422 -----calucurate and output effective addr
427 procedure ea_y_out is
433 --A.2. internal execution on memory data
437 if exec_cycle = T1 then
439 elsif exec_cycle = T2 then
441 dbuf_int_oe_n <= '0';
453 if exec_cycle = T1 then
455 elsif exec_cycle = T2 then
457 elsif exec_cycle = T3 then
459 dbuf_int_oe_n <= '0';
464 procedure a2_page_next is
466 --close open gate if page boundary crossed.
467 back_we(acc_cmd, '1');
468 front_we(acc_cmd, '1');
469 front_we(x_cmd, '1');
470 front_we(y_cmd, '1');
471 stat_alu_we_n <= '1';
474 procedure a2_abs_xy (is_x : in boolean) is
476 if exec_cycle = T1 then
478 elsif exec_cycle = T2 then
480 elsif exec_cycle = T3 then
484 if (is_x = true) then
489 dbuf_int_oe_n <= '0';
492 d_print("absx step 1");
493 elsif (exec_cycle = T0 and ea_carry_reg = '1') then
494 --case page boundary crossed.
496 d_print("absx 5 (page boudary crossed.)");
503 procedure a2_zp_xy (is_x : in boolean) is
505 if exec_cycle = T1 then
507 elsif exec_cycle = T2 then
510 dbuf_int_oe_n <= '0';
517 elsif exec_cycle = T3 then
520 if (is_x = true) then
529 procedure a2_indir_y is
531 if exec_cycle = T1 then
536 elsif exec_cycle = T2 then
544 dbuf_int_oe_n <= '0';
547 elsif exec_cycle = T3 then
551 dbuf_int_oe_n <= '0';
554 elsif exec_cycle = T4 then
556 dbuf_int_oe_n <= '1';
562 dbuf_int_oe_n <= '0';
564 if (ea_carry = '1') then
569 elsif (exec_cycle = T5) then
570 --case page boundary crossed.
572 d_print("(indir), y (page boudary crossed.)");
579 procedure a2_indir_x is
581 if exec_cycle = T1 then
586 elsif exec_cycle = T2 then
591 --output BAL @IAL, but cycle #2 is discarded
596 elsif exec_cycle = T3 then
601 dbuf_int_oe_n <= '0';
605 elsif exec_cycle = T4 then
608 --output BAH @IAL+x+1
609 dbuf_int_oe_n <= '0';
613 elsif (exec_cycle = T5) then
619 --A.3. store operation.
623 if exec_cycle = T1 then
625 elsif exec_cycle = T2 then
627 dbuf_int_oe_n <= '1';
638 procedure a3_zp_xy (is_x : in boolean) is
640 if exec_cycle = T1 then
642 elsif exec_cycle = T2 then
644 dbuf_int_oe_n <= '1';
651 elsif exec_cycle = T3 then
656 if (is_x = true) then
670 if exec_cycle = T1 then
672 elsif exec_cycle = T2 then
674 elsif exec_cycle = T3 then
676 dbuf_int_oe_n <= '1';
682 procedure a3_abs_xy (is_x : in boolean) is
684 if exec_cycle = T1 then
686 elsif exec_cycle = T2 then
688 elsif exec_cycle = T3 then
692 dbuf_int_oe_n <= '1';
693 if (is_x = true) then
699 elsif exec_cycle = T4 then
700 if (ea_carry_reg = '1') then
706 if (is_x = true) then
717 procedure a3_indir_y is
719 if exec_cycle = T1 then
724 elsif exec_cycle = T2 then
732 dbuf_int_oe_n <= '0';
735 elsif exec_cycle = T3 then
739 dbuf_int_oe_n <= '0';
742 elsif exec_cycle = T4 then
744 dbuf_int_oe_n <= '1';
752 elsif exec_cycle = T5 then
757 --ea_carry reg is suspicious. timing is not garanteed...
758 if (ea_carry_reg = '1') then
768 procedure a3_indir_x is
770 if exec_cycle = T1 then
775 elsif exec_cycle = T2 then
780 --output BAL @IAL, but cycle #2 is discarded
785 elsif exec_cycle = T3 then
790 dbuf_int_oe_n <= '0';
794 elsif exec_cycle = T4 then
797 --output BAH @IAL+x+1
798 dbuf_int_oe_n <= '0';
802 elsif (exec_cycle = T5) then
804 dbuf_int_oe_n <= '1';
810 ---A.4. read-modify-write operation
814 if exec_cycle = T1 then
816 elsif exec_cycle = T2 then
823 --keep data in the alu reg.
825 dbuf_int_oe_n <= '0';
827 elsif exec_cycle = T3 then
828 --t3 fix alu internal register.
832 dbuf_int_oe_n <= '1';
834 elsif exec_cycle = T4 then
835 --t5 cycle writes modified value.
846 if exec_cycle = T1 then
848 elsif exec_cycle = T2 then
850 dbuf_int_oe_n <= '1';
853 --t2 cycle read bal only.
857 elsif exec_cycle = T3 then
858 --t3 cycle read bal + x
864 --keep data in the alu reg.
866 dbuf_int_oe_n <= '0';
869 elsif exec_cycle = T4 then
875 --fix alu internal register.
877 dbuf_int_oe_n <= '1';
879 elsif exec_cycle = T5 then
880 dbuf_int_oe_n <= '1';
882 --t5 cycle writes modified value.
896 if exec_cycle = T1 then
898 elsif exec_cycle = T2 then
900 elsif exec_cycle = T3 then
903 --keep data in the alu reg.
905 dbuf_int_oe_n <= '0';
907 elsif exec_cycle = T4 then
910 --fix alu internal register.
912 dbuf_int_oe_n <= '1';
914 elsif exec_cycle = T5 then
915 dbuf_int_oe_n <= '1';
917 --t5 cycle writes modified value.
924 procedure a4_abs_x is
926 if exec_cycle = T1 then
928 elsif exec_cycle = T2 then
930 elsif exec_cycle = T3 then
931 --T3 cycle discarded.
935 dbuf_int_oe_n <= '0';
938 elsif exec_cycle = T4 then
941 if (ea_carry_reg = '1') then
947 --keep data in the alu reg.
949 dbuf_int_oe_n <= '0';
952 elsif exec_cycle = T5 then
953 --fix alu internal register.
955 dbuf_int_oe_n <= '1';
958 elsif exec_cycle = T6 then
959 --t5 cycle writes modified value.
969 procedure a51_push is
971 if exec_cycle = T1 then
974 elsif exec_cycle = T2 then
975 back_oe(sp_cmd, '0');
976 back_we(sp_cmd, '0');
985 procedure a52_pull is
987 if exec_cycle = T1 then
991 elsif exec_cycle = T2 then
992 --stack decrement first.
993 back_oe(sp_cmd, '0');
994 back_we(sp_cmd, '0');
999 elsif exec_cycle = T3 then
1001 back_we(sp_cmd, '1');
1003 ---pop data from stack.
1004 back_oe(sp_cmd, '0');
1006 dbuf_int_oe_n <= '0';
1012 -- A.5.8 branch operations
1014 procedure a58_branch (int_flg : in integer; br_cond : in std_logic) is
1016 if exec_cycle = T1 then
1018 if status_reg(int_flg) = br_cond then
1022 dbuf_int_oe_n <= '0';
1023 --dl_ah_we_n <= '0';
1026 d_print("no branch");
1029 elsif exec_cycle = T2 then
1032 dbuf_int_oe_n <= '1';
1033 --dl_ah_we_n <= '1';
1035 --calc relative addr.
1038 --dl_dh_oe_n <= '0';
1039 back_oe(pcl_cmd, '0');
1040 back_oe(pch_cmd, '0');
1041 back_we(pcl_cmd, '0');
1044 elsif (exec_cycle = T0 and ea_carry = '1') then
1045 d_print("page crossed.");
1046 --page crossed. adh calc.
1047 back_we(pcl_cmd, '1');
1048 back_oe(pcl_cmd, '0');
1049 back_oe(pch_cmd, '0');
1050 back_we(pch_cmd, '0');
1051 --dl_dh_oe_n <= '0';
1059 -------------------------------------------------------------
1060 -------------------------------------------------------------
1061 ---------------- main state machine start.... ---------------
1062 -------------------------------------------------------------
1063 -------------------------------------------------------------
1066 if (res_n = '0') then
1067 --prevent status revister from broken.
1068 stat_dec_oe_n <= '0';
1069 stat_bus_oe_n <= '1';
1070 stat_set_flg_n <= '1';
1072 stat_bus_all_n <= '1';
1073 stat_bus_nz_n <= '1';
1074 stat_alu_we_n <= '1';
1076 --pc l/h is reset vector.
1081 elsif (rising_edge(set_clk)) then
1082 d_print(string'("-"));
1084 if (nmi_n = '1') then
1085 --nmi handle flag reset.
1086 nmi_handled_n <= '1';
1090 --case dma is runnting.
1094 --dl_al_oe_n <= '1';
1100 elsif (exec_cycle = T0 and ea_carry = '0') then
1104 elsif exec_cycle = T1 or exec_cycle = T2 or exec_cycle = T3 or
1105 exec_cycle = T4 or exec_cycle = T5 or exec_cycle = T6 or
1106 (exec_cycle = T0 and ea_carry = '1') then
1109 ---asyncronous page change might happen.
1110 back_we(pch_cmd, '1');
1112 if exec_cycle = T1 then
1113 d_print("decode and execute inst: "
1114 & conv_hex8(conv_integer(instruction)));
1115 --disable pin for jmp instruction
1116 --dl_al_oe_n <= '1';
1117 back_we(pcl_cmd, '1');
1118 front_we(pch_cmd, '1');
1120 --grab instruction register data.
1124 --imelementation is wriiten in the order of hardware manual
1127 ----------------------------------------
1128 --A.1. Single byte instruction.
1129 ----------------------------------------
1130 if instruction = conv_std_logic_vector(16#0a#, dsize) then
1134 back_oe(acc_cmd, '0');
1135 front_we(acc_cmd, '0');
1139 elsif instruction = conv_std_logic_vector(16#18#, dsize) then
1144 elsif instruction = conv_std_logic_vector(16#d8#, dsize) then
1146 set_flag (st_D, '0');
1149 elsif instruction = conv_std_logic_vector(16#58#, dsize) then
1151 set_flag (st_I, '0');
1154 elsif instruction = conv_std_logic_vector(16#b8#, dsize) then
1156 set_flag (st_V, '0');
1159 elsif instruction = conv_std_logic_vector(16#ca#, dsize) then
1162 back_oe(x_cmd, '0');
1163 front_we(x_cmd, '0');
1168 elsif instruction = conv_std_logic_vector(16#88#, dsize) then
1171 back_oe(y_cmd, '0');
1172 front_we(y_cmd, '0');
1177 elsif instruction = conv_std_logic_vector(16#e8#, dsize) then
1180 back_oe(x_cmd, '0');
1181 front_we(x_cmd, '0');
1186 elsif instruction = conv_std_logic_vector(16#c8#, dsize) then
1189 back_oe(y_cmd, '0');
1190 front_we(y_cmd, '0');
1194 elsif instruction = conv_std_logic_vector(16#4a#, dsize) then
1198 back_oe(acc_cmd, '0');
1199 front_we(acc_cmd, '0');
1203 elsif instruction = conv_std_logic_vector(16#ea#, dsize) then
1207 elsif instruction = conv_std_logic_vector(16#2a#, dsize) then
1211 back_oe(acc_cmd, '0');
1212 front_we(acc_cmd, '0');
1216 elsif instruction = conv_std_logic_vector(16#6a#, dsize) then
1220 back_oe(acc_cmd, '0');
1221 front_we(acc_cmd, '0');
1225 elsif instruction = conv_std_logic_vector(16#38#, dsize) then
1230 elsif instruction = conv_std_logic_vector(16#f8#, dsize) then
1232 set_flag (st_D, '1');
1235 elsif instruction = conv_std_logic_vector(16#78#, dsize) then
1237 set_flag (st_I, '1');
1240 elsif instruction = conv_std_logic_vector(16#aa#, dsize) then
1244 front_oe(acc_cmd, '0');
1245 front_we(x_cmd, '0');
1247 elsif instruction = conv_std_logic_vector(16#a8#, dsize) then
1251 front_oe(acc_cmd, '0');
1252 front_we(y_cmd, '0');
1254 elsif instruction = conv_std_logic_vector(16#ba#, dsize) then
1258 front_oe(sp_cmd, '0');
1259 front_we(x_cmd, '0');
1261 elsif instruction = conv_std_logic_vector(16#8a#, dsize) then
1265 front_oe(x_cmd, '0');
1266 front_we(acc_cmd, '0');
1268 elsif instruction = conv_std_logic_vector(16#9a#, dsize) then
1272 front_oe(x_cmd, '0');
1273 front_we(sp_cmd, '0');
1275 elsif instruction = conv_std_logic_vector(16#98#, dsize) then
1279 front_oe(y_cmd, '0');
1280 front_we(acc_cmd, '0');
1284 ----------------------------------------
1285 --A.2. internal execution on memory data
1286 ----------------------------------------
1287 elsif instruction = conv_std_logic_vector(16#69#, dsize) then
1292 back_oe(acc_cmd, '0');
1293 back_we(acc_cmd, '0');
1296 elsif instruction = conv_std_logic_vector(16#65#, dsize) then
1300 if exec_cycle = T2 then
1302 back_oe(acc_cmd, '0');
1303 back_we(acc_cmd, '0');
1307 elsif instruction = conv_std_logic_vector(16#75#, dsize) then
1311 if exec_cycle = T3 then
1313 back_oe(acc_cmd, '0');
1314 back_we(acc_cmd, '0');
1318 elsif instruction = conv_std_logic_vector(16#6d#, dsize) then
1322 if exec_cycle = T3 then
1324 back_oe(acc_cmd, '0');
1325 back_we(acc_cmd, '0');
1329 elsif instruction = conv_std_logic_vector(16#7d#, dsize) then
1333 if exec_cycle = T3 or exec_cycle = T0 then
1335 back_oe(acc_cmd, '0');
1336 back_we(acc_cmd, '0');
1340 elsif instruction = conv_std_logic_vector(16#79#, dsize) then
1344 if exec_cycle = T3 or exec_cycle = T0 then
1346 back_oe(acc_cmd, '0');
1347 back_we(acc_cmd, '0');
1351 elsif instruction = conv_std_logic_vector(16#61#, dsize) then
1355 if exec_cycle = T5 then
1357 back_oe(acc_cmd, '0');
1358 back_we(acc_cmd, '0');
1362 elsif instruction = conv_std_logic_vector(16#71#, dsize) then
1366 if exec_cycle = T4 or exec_cycle = T0 then
1368 back_oe(acc_cmd, '0');
1369 back_we(acc_cmd, '0');
1373 elsif instruction = conv_std_logic_vector(16#29#, dsize) then
1378 back_oe(acc_cmd, '0');
1379 back_we(acc_cmd, '0');
1382 elsif instruction = conv_std_logic_vector(16#25#, dsize) then
1386 if exec_cycle = T2 then
1388 back_oe(acc_cmd, '0');
1389 back_we(acc_cmd, '0');
1393 elsif instruction = conv_std_logic_vector(16#35#, dsize) then
1397 if exec_cycle = T3 then
1399 back_oe(acc_cmd, '0');
1400 back_we(acc_cmd, '0');
1404 elsif instruction = conv_std_logic_vector(16#2d#, dsize) then
1408 if exec_cycle = T3 then
1410 back_oe(acc_cmd, '0');
1411 back_we(acc_cmd, '0');
1415 elsif instruction = conv_std_logic_vector(16#3d#, dsize) then
1419 if exec_cycle = T3 or exec_cycle = T0 then
1421 back_oe(acc_cmd, '0');
1422 back_we(acc_cmd, '0');
1426 elsif instruction = conv_std_logic_vector(16#39#, dsize) then
1430 if exec_cycle = T3 or exec_cycle = T0 then
1432 back_oe(acc_cmd, '0');
1433 back_we(acc_cmd, '0');
1437 elsif instruction = conv_std_logic_vector(16#21#, dsize) then
1441 if exec_cycle = T5 then
1443 back_oe(acc_cmd, '0');
1444 back_we(acc_cmd, '0');
1448 elsif instruction = conv_std_logic_vector(16#31#, dsize) then
1452 if exec_cycle = T4 or exec_cycle = T0 then
1454 back_oe(acc_cmd, '0');
1455 back_we(acc_cmd, '0');
1459 elsif instruction = conv_std_logic_vector(16#24#, dsize) then
1463 if exec_cycle = T2 then
1465 back_oe(acc_cmd, '0');
1469 elsif instruction = conv_std_logic_vector(16#2c#, dsize) then
1473 if exec_cycle = T3 then
1475 back_oe(acc_cmd, '0');
1479 elsif instruction = conv_std_logic_vector(16#c9#, dsize) then
1484 back_oe(acc_cmd, '0');
1487 elsif instruction = conv_std_logic_vector(16#c5#, dsize) then
1491 if exec_cycle = T2 then
1493 back_oe(acc_cmd, '0');
1497 elsif instruction = conv_std_logic_vector(16#d5#, dsize) then
1501 if exec_cycle = T3 then
1503 back_oe(acc_cmd, '0');
1507 elsif instruction = conv_std_logic_vector(16#cd#, dsize) then
1511 if exec_cycle = T3 then
1513 back_oe(acc_cmd, '0');
1517 elsif instruction = conv_std_logic_vector(16#dd#, dsize) then
1521 if exec_cycle = T3 or exec_cycle = T0 then
1523 back_oe(acc_cmd, '0');
1527 elsif instruction = conv_std_logic_vector(16#d9#, dsize) then
1531 if exec_cycle = T3 or exec_cycle = T0 then
1533 back_oe(acc_cmd, '0');
1537 elsif instruction = conv_std_logic_vector(16#c1#, dsize) then
1541 if exec_cycle = T5 then
1543 back_oe(acc_cmd, '0');
1547 elsif instruction = conv_std_logic_vector(16#d1#, dsize) then
1551 if exec_cycle = T4 or exec_cycle = T0 then
1553 back_oe(acc_cmd, '0');
1557 elsif instruction = conv_std_logic_vector(16#e0#, dsize) then
1562 back_oe(x_cmd, '0');
1565 elsif instruction = conv_std_logic_vector(16#e4#, dsize) then
1569 if exec_cycle = T2 then
1571 back_oe(x_cmd, '0');
1575 elsif instruction = conv_std_logic_vector(16#ec#, dsize) then
1579 if exec_cycle = T3 then
1581 back_oe(x_cmd, '0');
1585 elsif instruction = conv_std_logic_vector(16#c0#, dsize) then
1590 back_oe(y_cmd, '0');
1593 elsif instruction = conv_std_logic_vector(16#c4#, dsize) then
1597 if exec_cycle = T2 then
1599 back_oe(y_cmd, '0');
1603 elsif instruction = conv_std_logic_vector(16#cc#, dsize) then
1607 if exec_cycle = T3 then
1609 back_oe(y_cmd, '0');
1613 elsif instruction = conv_std_logic_vector(16#49#, dsize) then
1618 back_oe(acc_cmd, '0');
1619 back_we(acc_cmd, '0');
1622 elsif instruction = conv_std_logic_vector(16#45#, dsize) then
1626 if exec_cycle = T2 then
1628 back_oe(acc_cmd, '0');
1629 back_we(acc_cmd, '0');
1633 elsif instruction = conv_std_logic_vector(16#55#, dsize) then
1637 if exec_cycle = T3 then
1639 back_oe(acc_cmd, '0');
1640 back_we(acc_cmd, '0');
1644 elsif instruction = conv_std_logic_vector(16#4d#, dsize) then
1648 if exec_cycle = T3 then
1650 back_oe(acc_cmd, '0');
1651 back_we(acc_cmd, '0');
1655 elsif instruction = conv_std_logic_vector(16#5d#, dsize) then
1659 if exec_cycle = T3 or exec_cycle = T0 then
1661 back_oe(acc_cmd, '0');
1662 back_we(acc_cmd, '0');
1666 elsif instruction = conv_std_logic_vector(16#59#, dsize) then
1670 if exec_cycle = T3 or exec_cycle = T0 then
1672 back_oe(acc_cmd, '0');
1673 back_we(acc_cmd, '0');
1677 elsif instruction = conv_std_logic_vector(16#41#, dsize) then
1681 if exec_cycle = T5 then
1683 back_oe(acc_cmd, '0');
1684 back_we(acc_cmd, '0');
1688 elsif instruction = conv_std_logic_vector(16#51#, dsize) then
1692 if exec_cycle = T4 or exec_cycle = T0 then
1694 back_oe(acc_cmd, '0');
1695 back_we(acc_cmd, '0');
1699 elsif instruction = conv_std_logic_vector(16#a9#, dsize) then
1703 front_we(acc_cmd, '0');
1706 elsif instruction = conv_std_logic_vector(16#a5#, dsize) then
1710 if exec_cycle = T2 then
1711 front_we(acc_cmd, '0');
1715 elsif instruction = conv_std_logic_vector(16#b5#, dsize) then
1719 if exec_cycle = T3 then
1720 front_we(acc_cmd, '0');
1724 elsif instruction = conv_std_logic_vector(16#ad#, dsize) then
1728 if exec_cycle = T3 then
1730 front_we(acc_cmd, '0');
1733 elsif instruction = conv_std_logic_vector(16#bd#, dsize) then
1737 if exec_cycle = T3 or exec_cycle = T0 then
1739 front_we(acc_cmd, '0');
1743 elsif instruction = conv_std_logic_vector(16#b9#, dsize) then
1747 if exec_cycle = T3 or exec_cycle = T0 then
1749 front_we(acc_cmd, '0');
1753 elsif instruction = conv_std_logic_vector(16#a1#, dsize) then
1757 if exec_cycle = T5 then
1758 front_we(acc_cmd, '0');
1762 elsif instruction = conv_std_logic_vector(16#b1#, dsize) then
1766 if exec_cycle = T4 or exec_cycle = T0 then
1768 front_we(acc_cmd, '0');
1772 elsif instruction = conv_std_logic_vector(16#a2#, dsize) then
1777 front_we(x_cmd, '0');
1779 elsif instruction = conv_std_logic_vector(16#a6#, dsize) then
1783 if exec_cycle = T2 then
1784 front_we(x_cmd, '0');
1788 elsif instruction = conv_std_logic_vector(16#b6#, dsize) then
1792 if exec_cycle = T3 then
1793 front_we(x_cmd, '0');
1797 elsif instruction = conv_std_logic_vector(16#ae#, dsize) then
1801 if exec_cycle = T3 then
1803 front_we(x_cmd, '0');
1806 elsif instruction = conv_std_logic_vector(16#be#, dsize) then
1810 if exec_cycle = T3 or exec_cycle = T0 then
1811 front_we(x_cmd, '0');
1815 elsif instruction = conv_std_logic_vector(16#a0#, dsize) then
1820 front_we(y_cmd, '0');
1822 elsif instruction = conv_std_logic_vector(16#a4#, dsize) then
1826 if exec_cycle = T2 then
1827 front_we(y_cmd, '0');
1831 elsif instruction = conv_std_logic_vector(16#b4#, dsize) then
1835 if exec_cycle = T3 then
1836 front_we(y_cmd, '0');
1840 elsif instruction = conv_std_logic_vector(16#ac#, dsize) then
1844 if exec_cycle = T3 then
1846 front_we(y_cmd, '0');
1849 elsif instruction = conv_std_logic_vector(16#bc#, dsize) then
1853 if exec_cycle = T3 or exec_cycle = T0 then
1855 front_we(y_cmd, '0');
1858 elsif instruction = conv_std_logic_vector(16#09#, dsize) then
1863 back_oe(acc_cmd, '0');
1864 back_we(acc_cmd, '0');
1867 elsif instruction = conv_std_logic_vector(16#05#, dsize) then
1871 if exec_cycle = T2 then
1873 back_oe(acc_cmd, '0');
1874 back_we(acc_cmd, '0');
1878 elsif instruction = conv_std_logic_vector(16#15#, dsize) then
1882 if exec_cycle = T3 then
1884 back_oe(acc_cmd, '0');
1885 back_we(acc_cmd, '0');
1889 elsif instruction = conv_std_logic_vector(16#0d#, dsize) then
1893 if exec_cycle = T3 then
1895 back_oe(acc_cmd, '0');
1896 back_we(acc_cmd, '0');
1900 elsif instruction = conv_std_logic_vector(16#1d#, dsize) then
1904 if exec_cycle = T3 or exec_cycle = T0 then
1906 back_oe(acc_cmd, '0');
1907 back_we(acc_cmd, '0');
1911 elsif instruction = conv_std_logic_vector(16#19#, dsize) then
1915 if exec_cycle = T3 or exec_cycle = T0 then
1917 back_oe(acc_cmd, '0');
1918 back_we(acc_cmd, '0');
1922 elsif instruction = conv_std_logic_vector(16#01#, dsize) then
1926 if exec_cycle = T5 then
1928 back_oe(acc_cmd, '0');
1929 back_we(acc_cmd, '0');
1933 elsif instruction = conv_std_logic_vector(16#11#, dsize) then
1937 if exec_cycle = T4 or exec_cycle = T0 then
1939 back_oe(acc_cmd, '0');
1940 back_we(acc_cmd, '0');
1944 elsif instruction = conv_std_logic_vector(16#e9#, dsize) then
1949 back_oe(acc_cmd, '0');
1950 back_we(acc_cmd, '0');
1953 elsif instruction = conv_std_logic_vector(16#e5#, dsize) then
1957 if exec_cycle = T2 then
1959 back_oe(acc_cmd, '0');
1960 back_we(acc_cmd, '0');
1964 elsif instruction = conv_std_logic_vector(16#f5#, dsize) then
1968 if exec_cycle = T3 then
1970 back_oe(acc_cmd, '0');
1971 back_we(acc_cmd, '0');
1975 elsif instruction = conv_std_logic_vector(16#ed#, dsize) then
1979 if exec_cycle = T3 then
1981 back_oe(acc_cmd, '0');
1982 back_we(acc_cmd, '0');
1986 elsif instruction = conv_std_logic_vector(16#fd#, dsize) then
1990 if exec_cycle = T3 or exec_cycle = T0 then
1992 back_oe(acc_cmd, '0');
1993 back_we(acc_cmd, '0');
1997 elsif instruction = conv_std_logic_vector(16#f9#, dsize) then
2001 if exec_cycle = T3 or exec_cycle = T0 then
2003 back_oe(acc_cmd, '0');
2004 back_we(acc_cmd, '0');
2008 elsif instruction = conv_std_logic_vector(16#e1#, dsize) then
2012 if exec_cycle = T5 then
2014 back_oe(acc_cmd, '0');
2015 back_we(acc_cmd, '0');
2019 elsif instruction = conv_std_logic_vector(16#f1#, dsize) then
2023 if exec_cycle = T4 or exec_cycle = T0 then
2025 back_oe(acc_cmd, '0');
2026 back_we(acc_cmd, '0');
2032 ----------------------------------------
2033 ---A.3. store operation.
2034 ----------------------------------------
2035 elsif instruction = conv_std_logic_vector(16#85#, dsize) then
2039 if exec_cycle = T2 then
2040 front_oe(acc_cmd, '0');
2043 elsif instruction = conv_std_logic_vector(16#95#, dsize) then
2047 if exec_cycle = T2 then
2048 front_oe(acc_cmd, '0');
2051 elsif instruction = conv_std_logic_vector(16#8d#, dsize) then
2055 if exec_cycle = T3 then
2056 front_oe(acc_cmd, '0');
2059 elsif instruction = conv_std_logic_vector(16#9d#, dsize) then
2063 if exec_cycle = T4 then
2064 front_oe(acc_cmd, '0');
2067 elsif instruction = conv_std_logic_vector(16#99#, dsize) then
2071 if exec_cycle = T4 then
2072 front_oe(acc_cmd, '0');
2075 elsif instruction = conv_std_logic_vector(16#81#, dsize) then
2079 if exec_cycle = T5 then
2080 front_oe(acc_cmd, '0');
2083 elsif instruction = conv_std_logic_vector(16#91#, dsize) then
2087 if exec_cycle = T5 then
2088 front_oe(acc_cmd, '0');
2091 elsif instruction = conv_std_logic_vector(16#86#, dsize) then
2095 if exec_cycle = T2 then
2096 front_oe(x_cmd, '0');
2099 elsif instruction = conv_std_logic_vector(16#96#, dsize) then
2103 if exec_cycle = T2 then
2104 front_oe(x_cmd, '0');
2107 elsif instruction = conv_std_logic_vector(16#8e#, dsize) then
2111 if exec_cycle = T3 then
2112 front_oe(x_cmd, '0');
2115 elsif instruction = conv_std_logic_vector(16#84#, dsize) then
2119 if exec_cycle = T2 then
2120 front_oe(y_cmd, '0');
2123 elsif instruction = conv_std_logic_vector(16#94#, dsize) then
2127 if exec_cycle = T2 then
2128 front_oe(y_cmd, '0');
2131 elsif instruction = conv_std_logic_vector(16#8c#, dsize) then
2135 if exec_cycle = T3 then
2136 front_oe(y_cmd, '0');
2140 ----------------------------------------
2141 ---A.4. read-modify-write operation
2142 ----------------------------------------
2143 elsif instruction = conv_std_logic_vector(16#06#, dsize) then
2147 if exec_cycle = T4 then
2151 elsif instruction = conv_std_logic_vector(16#16#, dsize) then
2155 if exec_cycle = T5 then
2159 elsif instruction = conv_std_logic_vector(16#0e#, dsize) then
2163 if exec_cycle = T5 then
2167 elsif instruction = conv_std_logic_vector(16#1e#, dsize) then
2171 if exec_cycle = T6 then
2175 elsif instruction = conv_std_logic_vector(16#c6#, dsize) then
2179 if exec_cycle = T4 then
2183 elsif instruction = conv_std_logic_vector(16#d6#, dsize) then
2187 if exec_cycle = T5 then
2191 elsif instruction = conv_std_logic_vector(16#ce#, dsize) then
2195 if exec_cycle = T5 then
2199 elsif instruction = conv_std_logic_vector(16#de#, dsize) then
2203 if exec_cycle = T6 then
2207 elsif instruction = conv_std_logic_vector(16#e6#, dsize) then
2211 if exec_cycle = T4 then
2215 elsif instruction = conv_std_logic_vector(16#f6#, dsize) then
2219 if exec_cycle = T5 then
2223 elsif instruction = conv_std_logic_vector(16#ee#, dsize) then
2227 if exec_cycle = T5 then
2231 elsif instruction = conv_std_logic_vector(16#fe#, dsize) then
2235 if exec_cycle = T6 then
2239 elsif instruction = conv_std_logic_vector(16#46#, dsize) then
2243 if exec_cycle = T4 then
2247 elsif instruction = conv_std_logic_vector(16#56#, dsize) then
2251 if exec_cycle = T5 then
2255 elsif instruction = conv_std_logic_vector(16#4e#, dsize) then
2259 if exec_cycle = T5 then
2263 elsif instruction = conv_std_logic_vector(16#5e#, dsize) then
2267 if exec_cycle = T6 then
2271 elsif instruction = conv_std_logic_vector(16#26#, dsize) then
2275 if exec_cycle = T4 then
2279 elsif instruction = conv_std_logic_vector(16#36#, dsize) then
2283 if exec_cycle = T5 then
2287 elsif instruction = conv_std_logic_vector(16#2e#, dsize) then
2291 if exec_cycle = T5 then
2295 elsif instruction = conv_std_logic_vector(16#3e#, dsize) then
2299 if exec_cycle = T6 then
2303 elsif instruction = conv_std_logic_vector(16#66#, dsize) then
2307 if exec_cycle = T4 then
2311 elsif instruction = conv_std_logic_vector(16#76#, dsize) then
2315 if exec_cycle = T5 then
2319 elsif instruction = conv_std_logic_vector(16#6e#, dsize) then
2323 if exec_cycle = T5 then
2327 elsif instruction = conv_std_logic_vector(16#7e#, dsize) then
2331 if exec_cycle = T6 then
2336 ----------------------------------------
2337 --A.5. miscellaneous oprations.
2338 ----------------------------------------
2341 elsif instruction = conv_std_logic_vector(16#08#, dsize) then
2344 if exec_cycle = T2 then
2345 stat_bus_oe_n <= '0';
2348 elsif instruction = conv_std_logic_vector(16#48#, dsize) then
2351 if exec_cycle = T2 then
2352 front_oe(acc_cmd, '0');
2355 elsif instruction = conv_std_logic_vector(16#28#, dsize) then
2358 if exec_cycle = T3 then
2359 stat_dec_oe_n <= '1';
2360 stat_bus_all_n <= '0';
2363 elsif instruction = conv_std_logic_vector(16#68#, dsize) then
2366 if exec_cycle = T3 then
2367 front_we(acc_cmd, '0');
2372 ----------------------------------------
2374 ----------------------------------------
2375 elsif instruction = conv_std_logic_vector(16#20#, dsize) then
2376 if exec_cycle = T1 then
2377 d_print("jsr abs 2");
2380 dbuf_int_oe_n <= '0';
2382 --dl_al_we_n <= '0';
2384 elsif exec_cycle = T2 then
2387 dbuf_int_oe_n <= '1';
2388 --dl_al_we_n <= '1';
2390 --push return addr high into stack.
2393 front_oe(pch_cmd, '0');
2394 back_oe(sp_cmd, '0');
2395 back_we(sp_cmd, '0');
2398 elsif exec_cycle = T3 then
2400 front_oe(pch_cmd, '1');
2402 --push return addr low into stack.
2405 front_oe(pcl_cmd, '0');
2406 back_oe(sp_cmd, '0');
2407 back_we(sp_cmd, '0');
2411 elsif exec_cycle = T4 then
2415 front_oe(pcl_cmd, '1');
2416 back_oe(sp_cmd, '1');
2417 back_we(sp_cmd, '1');
2421 back_oe(pch_cmd, '0');
2422 back_oe(pcl_cmd, '0');
2423 dbuf_int_oe_n <= '0';
2424 --dl_ah_we_n <= '0';
2427 elsif exec_cycle = T5 then
2430 back_oe(pch_cmd, '1');
2431 back_oe(pcl_cmd, '1');
2432 dbuf_int_oe_n <= '1';
2433 --dl_ah_we_n <= '1';
2437 --dl_dh_oe_n <= '0';
2438 front_we(pch_cmd, '0');
2441 --dl_al_oe_n <= '0';
2442 back_we(pcl_cmd, '0');
2445 end if; --if exec_cycle = T1 then
2448 elsif instruction = conv_std_logic_vector(16#00#, dsize) then
2450 ----------------------------------------
2451 -- A.5.5 return from interrupt
2452 ----------------------------------------
2453 elsif instruction = conv_std_logic_vector(16#40#, dsize) then
2454 if exec_cycle = T1 then
2458 --pop stack (decrement only)
2459 back_oe(sp_cmd, '0');
2460 back_we(sp_cmd, '0');
2465 elsif exec_cycle = T2 then
2469 back_oe(sp_cmd, '0');
2470 back_we(sp_cmd, '0');
2475 stat_dec_oe_n <= '1';
2476 dbuf_int_oe_n <= '0';
2477 stat_bus_all_n <= '0';
2480 elsif exec_cycle = T3 then
2482 stat_bus_all_n <= '1';
2485 back_oe(sp_cmd, '0');
2486 back_we(sp_cmd, '0');
2491 dbuf_int_oe_n <= '0';
2492 front_we(pcl_cmd, '0');
2495 elsif exec_cycle = T4 then
2497 --stack decrement stop.
2498 back_we(sp_cmd, '1');
2500 front_we(pcl_cmd, '1');
2503 back_oe(sp_cmd, '0');
2506 dbuf_int_oe_n <= '0';
2507 front_we(pch_cmd, '0');
2510 elsif exec_cycle = T5 then
2512 back_oe(sp_cmd, '1');
2515 dbuf_int_oe_n <= '1';
2516 front_we(pch_cmd, '1');
2520 end if; --if exec_cycle = T1 then
2522 ----------------------------------------
2524 ----------------------------------------
2525 elsif instruction = conv_std_logic_vector(16#4c#, dsize) then
2527 if exec_cycle = T1 then
2529 --fetch next opcode (abs low).
2532 --latch abs low data.
2533 dbuf_int_oe_n <= '0';
2534 --dl_al_we_n <= '0';
2536 elsif exec_cycle = T2 then
2538 --dl_al_we_n <= '1';
2544 dbuf_int_oe_n <= '0';
2545 --dl_ah_we_n <= '0';
2547 front_we(pch_cmd, '0');
2552 elsif instruction = conv_std_logic_vector(16#6c#, dsize) then
2554 if exec_cycle = T1 then
2556 --fetch next opcode (abs low).
2559 --latch abs low data.
2560 dbuf_int_oe_n <= '0';
2561 --dl_al_we_n <= '0';
2563 elsif exec_cycle = T2 then
2565 --dl_al_we_n <= '1';
2571 dbuf_int_oe_n <= '0';
2572 --dl_ah_we_n <= '0';
2575 elsif exec_cycle = T3 then
2577 --dl_ah_we_n <= '1';
2580 --dl_ah_oe_n <= '0';
2581 --dl_al_oe_n <= '0';
2582 front_we(pcl_cmd, '0');
2585 elsif exec_cycle = T4 then
2586 --dl_ah_oe_n <= '0';
2587 --dl_al_oe_n <= '0';
2588 front_we(pcl_cmd, '1');
2591 front_we(pch_cmd, '0');
2599 ----------------------------------------
2600 -- A.5.7 return from soubroutine
2601 ----------------------------------------
2602 elsif instruction = conv_std_logic_vector(16#60#, dsize) then
2603 if exec_cycle = T1 then
2607 --pop stack (decrement only)
2608 back_oe(sp_cmd, '0');
2609 back_we(sp_cmd, '0');
2614 elsif exec_cycle = T2 then
2618 back_oe(sp_cmd, '0');
2619 back_we(sp_cmd, '0');
2624 dbuf_int_oe_n <= '0';
2625 front_we(pcl_cmd, '0');
2628 elsif exec_cycle = T3 then
2630 --stack decrement stop.
2631 back_we(sp_cmd, '1');
2633 front_we(pcl_cmd, '1');
2636 back_oe(sp_cmd, '0');
2639 dbuf_int_oe_n <= '0';
2640 front_we(pch_cmd, '0');
2643 elsif exec_cycle = T4 then
2645 back_oe(sp_cmd, '1');
2648 dbuf_int_oe_n <= '1';
2649 front_we(pch_cmd, '1');
2651 --complying h/w manual...
2653 elsif exec_cycle = T5 then
2659 end if; --if exec_cycle = T1 then
2661 ----------------------------------------
2662 -- A.5.8 branch operations
2663 ----------------------------------------
2664 elsif instruction = conv_std_logic_vector(16#90#, dsize) then
2666 a58_branch (st_C, '0');
2668 elsif instruction = conv_std_logic_vector(16#b0#, dsize) then
2670 a58_branch (st_C, '1');
2672 elsif instruction = conv_std_logic_vector(16#f0#, dsize) then
2674 a58_branch (st_Z, '1');
2676 elsif instruction = conv_std_logic_vector(16#30#, dsize) then
2678 a58_branch (st_N, '1');
2680 elsif instruction = conv_std_logic_vector(16#d0#, dsize) then
2682 a58_branch (st_Z, '0');
2684 elsif instruction = conv_std_logic_vector(16#10#, dsize) then
2686 a58_branch (st_N, '0');
2688 elsif instruction = conv_std_logic_vector(16#50#, dsize) then
2690 a58_branch (st_V, '0');
2692 elsif instruction = conv_std_logic_vector(16#70#, dsize) then
2694 a58_branch (st_V, '1');
2697 ---unknown instruction!!!!
2699 report "======== unknow instruction "
2700 & conv_hex8(conv_integer(instruction))
2702 end if; --if instruction = conv_std_logic_vector(16#0a#, dsize)
2704 elsif exec_cycle = R0 then
2705 d_print(string'("reset"));
2707 --initialize port...
2710 dbuf_int_oe_n <= '1';
2711 --dl_al_we_n <= '1';
2712 --dl_ah_we_n <= '1';
2713 --dl_al_oe_n <= '1';
2714 --dl_ah_oe_n <= '1';
2715 --dl_dh_oe_n <= '1';
2737 stat_dec_oe_n <= '0';
2738 stat_bus_oe_n <= '1';
2739 stat_set_flg_n <= '1';
2741 stat_bus_all_n <= '1';
2742 stat_bus_nz_n <= '1';
2743 stat_alu_we_n <= '1';
2748 nmi_handled_n <= '1';
2752 elsif exec_cycle = R1 or exec_cycle = N1 then
2756 --dl_al_oe_n <= '1';
2764 --front_oe(pch_cmd, '0');
2765 back_oe(sp_cmd, '0');
2766 back_we(sp_cmd, '0');
2769 if exec_cycle = R1 then
2771 elsif exec_cycle = N1 then
2775 elsif exec_cycle = R2 or exec_cycle = N2 then
2776 front_oe(pch_cmd, '1');
2781 front_oe(pcl_cmd, '0');
2782 back_oe(sp_cmd, '0');
2783 back_we(sp_cmd, '0');
2786 if exec_cycle = R2 then
2788 elsif exec_cycle = N2 then
2792 elsif exec_cycle = R3 or exec_cycle = N3 then
2793 front_oe(pcl_cmd, '1');
2798 stat_bus_oe_n <= '0';
2799 back_oe(sp_cmd, '0');
2800 back_we(sp_cmd, '0');
2803 if exec_cycle = R3 then
2805 elsif exec_cycle = N3 then
2809 elsif exec_cycle = R4 or exec_cycle = N4 then
2810 stat_bus_oe_n <= '1';
2813 front_oe(pcl_cmd, '1');
2814 back_oe(sp_cmd, '1');
2815 back_we(sp_cmd, '1');
2817 --fetch reset vector low
2819 dbuf_int_oe_n <= '0';
2820 front_we(pcl_cmd, '0');
2821 --dl_al_oe_n <= '1';
2822 --dl_ah_oe_n <= '1';
2824 if exec_cycle = R4 then
2828 elsif exec_cycle = N4 then
2834 elsif exec_cycle = R5 or exec_cycle = N5 then
2835 front_we(pcl_cmd, '1');
2837 --fetch reset vector hi
2839 dbuf_int_oe_n <= '0';
2840 front_we(pch_cmd, '0');
2843 if exec_cycle = N5 then
2844 nmi_handled_n <= '0';
2846 --start execute cycle.
2849 end if; --if rdy = '0' then
2851 end if; -- if (res_n = '0') then