OpenCores
URL https://opencores.org/ocsvn/t48/t48/trunk

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_4_beta/] [rtl/] [vhdl/] [decoder.vhd] - Blame information for rev 292

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 arniml
-------------------------------------------------------------------------------
2
--
3
-- The Decoder unit.
4
-- It decodes the instruction opcodes and executes them.
5
--
6 134 arniml
-- $Id: decoder.vhd,v 1.15 2004-09-12 00:35:44 arniml Exp $
7 4 arniml
--
8
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
9
--
10
-- All rights reserved
11
--
12
-- Redistribution and use in source and synthezised forms, with or without
13
-- modification, are permitted provided that the following conditions are met:
14
--
15
-- Redistributions of source code must retain the above copyright notice,
16
-- this list of conditions and the following disclaimer.
17
--
18
-- Redistributions in synthesized form must reproduce the above copyright
19
-- notice, this list of conditions and the following disclaimer in the
20
-- documentation and/or other materials provided with the distribution.
21
--
22
-- Neither the name of the author nor the names of other contributors may
23
-- be used to endorse or promote products derived from this software without
24
-- specific prior written permission.
25
--
26
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
28
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
30
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
-- POSSIBILITY OF SUCH DAMAGE.
37
--
38
-- Please report bugs to the author, but before you do so, please
39
-- make sure that this is not a derivative work and that
40
-- you have the latest version of this file.
41
--
42
-- The latest version of this file can be found at:
43
--      http://www.opencores.org/cvsweb.shtml/t48/
44
--
45
-------------------------------------------------------------------------------
46
 
47
library ieee;
48
use ieee.std_logic_1164.all;
49
 
50
use work.t48_pack.word_t;
51
use work.t48_pack.mstate_t;
52
use work.alu_pack.alu_op_t;
53
use work.cond_branch_pack.all;
54
use work.dmem_ctrl_pack.all;
55
use work.pmem_ctrl_pack.all;
56
 
57
entity decoder is
58
 
59
  generic (
60
    -- store mnemonic in flip-flops (registered-out)
61
    register_mnemonic_g   : integer := 1
62
  );
63
 
64
  port (
65
    -- Global Interface -------------------------------------------------------
66
    clk_i                  : in  std_logic;
67
    res_i                  : in  std_logic;
68
    en_clk_i               : in  boolean;
69
    ea_i                   : in  std_logic;
70
    ale_i                  : in  boolean;
71
    int_n_i                : in  std_logic;
72
    t0_dir_o               : out std_logic;
73
    -- T48 Bus Interface ------------------------------------------------------
74
    data_i                 : in  word_t;
75
    data_o                 : out word_t;
76
    stack_high_o           : out boolean;
77
    alu_write_accu_o       : out boolean;
78
    alu_write_shadow_o     : out boolean;
79
    alu_write_temp_reg_o   : out boolean;
80
    alu_read_alu_o         : out boolean;
81
    bus_write_bus_o        : out boolean;
82
    bus_read_bus_o         : out boolean;
83
    dm_write_dmem_addr_o   : out boolean;
84
    dm_write_dmem_o        : out boolean;
85
    dm_read_dmem_o         : out boolean;
86
    p1_write_p1_o          : out boolean;
87
    p1_read_p1_o           : out boolean;
88
    p2_write_p2_o          : out boolean;
89
    p2_write_exp_o         : out boolean;
90
    p2_read_p2_o           : out boolean;
91 21 arniml
    p2_read_exp_o          : out boolean;
92 4 arniml
    pm_write_pcl_o         : out boolean;
93
    pm_read_pcl_o          : out boolean;
94
    pm_write_pch_o         : out boolean;
95
    pm_read_pch_o          : out boolean;
96
    pm_read_pmem_o         : out boolean;
97
    psw_read_psw_o         : out boolean;
98
    psw_read_sp_o          : out boolean;
99
    psw_write_psw_o        : out boolean;
100
    psw_write_sp_o         : out boolean;
101
    -- ALU Interface ----------------------------------------------------------
102
    alu_carry_i            : in  std_logic;
103
    alu_op_o               : out alu_op_t;
104
    alu_use_carry_o        : out boolean;
105 27 arniml
    alu_da_high_o          : out boolean;
106 38 arniml
    alu_accu_low_o         : out boolean;
107 27 arniml
    alu_p06_temp_reg_o     : out boolean;
108
    alu_p60_temp_reg_o     : out boolean;
109
    alu_da_overflow_i      : in  boolean;
110 4 arniml
    -- BUS Interface ----------------------------------------------------------
111
    bus_output_pcl_o       : out boolean;
112
    bus_bidir_bus_o        : out boolean;
113
    -- Clock Controller Interface ---------------------------------------------
114
    clk_multi_cycle_o      : out boolean;
115
    clk_assert_psen_o      : out boolean;
116
    clk_assert_prog_o      : out boolean;
117
    clk_assert_rd_o        : out boolean;
118
    clk_assert_wr_o        : out boolean;
119
    clk_mstate_i           : in  mstate_t;
120
    clk_second_cycle_i     : in  boolean;
121
    -- Conditional Branch Logic Interface -------------------------------------
122
    cnd_compute_take_o     : out boolean;
123
    cnd_branch_cond_o      : out branch_conditions_t;
124
    cnd_take_branch_i      : in  boolean;
125
    cnd_comp_value_o       : out comp_value_t;
126
    cnd_f1_o               : out std_logic;
127
    cnd_tf_o               : out std_logic;
128
    -- Data Memory Controller Interface ---------------------------------------
129
    dm_addr_type_o         : out dmem_addr_ident_t;
130
    -- Port 1 Interface -------------------------------------------------------
131
    p1_read_reg_o          : out boolean;
132
    -- Port 2 Interface -------------------------------------------------------
133
    p2_read_reg_o          : out boolean;
134
    p2_output_pch_o        : out boolean;
135
    p2_output_exp_o        : out boolean;
136
    -- Program Memory Controller Interface ------------------------------------
137
    pm_inc_pc_o            : out boolean;
138
    pm_write_pmem_addr_o   : out boolean;
139
    pm_addr_type_o         : out pmem_addr_ident_t;
140
    -- Program Status Word Interface ------------------------------------------
141
    psw_special_data_o     : out std_logic;
142
    psw_carry_i            : in  std_logic;
143 27 arniml
    psw_aux_carry_i        : in  std_logic;
144 4 arniml
    psw_f0_i               : in  std_logic;
145
    psw_inc_stackp_o       : out boolean;
146
    psw_dec_stackp_o       : out boolean;
147
    psw_write_carry_o      : out boolean;
148
    psw_write_aux_carry_o  : out boolean;
149
    psw_write_f0_o         : out boolean;
150
    psw_write_bs_o         : out boolean;
151
    -- Timer Interface --------------------------------------------------------
152
    tim_read_timer_o       : out boolean;
153
    tim_write_timer_o      : out boolean;
154
    tim_start_t_o          : out boolean;
155
    tim_start_cnt_o        : out boolean;
156
    tim_stop_tcnt_o        : out boolean;
157
    tim_overflow_i         : in  boolean
158
  );
159
 
160
end decoder;
161
 
162
 
163
use work.t48_pack.all;
164
use work.alu_pack.all;
165
use work.decoder_pack.all;
166
 
167
use work.t48_comp_pack.opc_decoder;
168
use work.t48_comp_pack.int;
169
 
170 53 arniml
-- pragma translate_off
171
use work.t48_tb_pack.tb_istrobe_s;
172
-- pragma translate_on
173
 
174 4 arniml
architecture rtl of decoder is
175
 
176 92 arniml
  -- Enable fixing a bug of Quartus II 4.0
177
  constant enable_quartus_bugfix_c : boolean := true;
178
 
179 4 arniml
  -- Opcode Decoder
180
  signal opc_multi_cycle_s : boolean;
181
  signal opc_read_bus_s    : boolean;
182
  signal opc_inj_int_s     : boolean;
183
  signal opc_opcode_s      : word_t;
184
  signal opc_mnemonic_s    : mnemonic_t;
185
  signal last_cycle_s      : boolean;
186
 
187
  -- state translators
188
  signal assert_psen_s     : boolean;
189
 
190
  -- branch taken handshake
191
  signal branch_taken_s,
192
         branch_taken_q        : boolean;
193
  signal pm_inc_pc_s           : boolean;
194
  signal pm_write_pmem_addr_s  : boolean;
195
  -- additional signal to increment PC during CALL
196
  signal add_inc_pc_s          : boolean;
197
  -- addtional signal to set PC during RET(R)
198
  signal add_write_pmem_addr_s : boolean;
199
 
200
  -- Flag 1
201
  signal clear_f1_s,
202
         cpl_f1_s          : boolean;
203
  signal f1_q              : std_logic;
204
  -- memory bank select
205
  signal clear_mb_s,
206
         set_mb_s          : boolean;
207
  signal mb_q              : std_logic;
208
 
209
  -- T0 direction selection
210
  signal ent0_clk_s        : boolean;
211
  signal t0_dir_q          : std_logic;
212
 
213
  signal data_s            : word_t;
214
  signal read_dec_s        : boolean;
215
 
216
  signal tf_s              : std_logic;
217
 
218
  signal bus_read_bus_s    : boolean;
219
  signal add_read_bus_s    : boolean;
220
 
221
  signal dm_write_dmem_s   : boolean;
222
 
223
  -- interrupt handling
224
  signal jtf_executed_s    : boolean;
225
  signal en_tcnti_s        : boolean;
226
  signal dis_tcnti_s       : boolean;
227
  signal en_i_s            : boolean;
228
  signal dis_i_s           : boolean;
229
  signal tim_int_s         : boolean;
230
  signal retr_executed_s   : boolean;
231
  signal int_executed_s    : boolean;
232
  signal int_pending_s     : boolean;
233 120 arniml
  signal int_in_progress_s : boolean;
234 4 arniml
 
235 38 arniml
  -- pragma translate_off
236 64 arniml
  signal istrobe_res_q     : std_logic;
237
  signal istrobe_q         : std_logic;
238 60 arniml
  signal injected_int_q    : std_logic;
239 38 arniml
  -- pragma translate_on
240
 
241 4 arniml
begin
242
 
243
  -----------------------------------------------------------------------------
244
  -- Opcode Decoder
245
  -----------------------------------------------------------------------------
246
  opc_decoder_b : opc_decoder
247
    generic map (
248
      register_mnemonic_g => register_mnemonic_g
249
    )
250
    port map (
251
      clk_i         => clk_i,
252
      res_i         => res_i,
253
      en_clk_i      => en_clk_i,
254
      data_i        => data_i,
255
      read_bus_i    => opc_read_bus_s,
256
      inj_int_i     => opc_inj_int_s,
257
      opcode_o      => opc_opcode_s,
258
      mnemonic_o    => opc_mnemonic_s,
259
      multi_cycle_o => opc_multi_cycle_s
260
    );
261
 
262
 
263
  -----------------------------------------------------------------------------
264
  -- Interrupt Controller.
265
  -----------------------------------------------------------------------------
266
  int_b : int
267
    port map (
268 120 arniml
      clk_i             => clk_i,
269
      res_i             => res_i,
270
      en_clk_i          => en_clk_i,
271
      clk_mstate_i      => clk_mstate_i,
272
      jtf_executed_i    => jtf_executed_s,
273
      tim_overflow_i    => tim_overflow_i,
274
      tf_o              => tf_s,
275
      en_tcnti_i        => en_tcnti_s,
276
      dis_tcnti_i       => dis_tcnti_s,
277
      int_n_i           => int_n_i,
278
      ale_i             => ale_i,
279
      last_cycle_i      => last_cycle_s,
280
      en_i_i            => en_i_s,
281
      dis_i_i           => dis_i_s,
282
      ext_int_o         => open,
283
      tim_int_o         => tim_int_s,
284
      retr_executed_i   => retr_executed_s,
285
      int_executed_i    => int_executed_s,
286
      int_pending_o     => int_pending_s,
287
      int_in_progress_o => int_in_progress_s
288 4 arniml
    );
289
 
290
  last_cycle_s <= not opc_multi_cycle_s or
291
                  (opc_multi_cycle_s and clk_second_cycle_i);
292
 
293
  -----------------------------------------------------------------------------
294
  -- Process machine_cycle
295
  --
296
  -- Purpose:
297
  --   Generates the control signals that are basically needed for the
298
  --   handling of a machine cycle.
299
  --
300
  machine_cycle: process (clk_mstate_i,
301
                          clk_second_cycle_i,
302 64 arniml
                          last_cycle_s,
303 4 arniml
                          ea_i,
304
                          assert_psen_s,
305
                          branch_taken_q,
306
                          int_pending_s)
307
 
308
   variable need_address_v      : boolean;
309
 
310
  begin
311
    -- default assignments
312
    clk_assert_psen_o    <= false;
313
    pm_inc_pc_s          <= false;
314
    pm_write_pmem_addr_s <= false;
315
    pm_read_pmem_o       <= false;
316
    bus_output_pcl_o     <= false;
317
    p2_output_pch_o      <= false;
318
    opc_read_bus_s       <= false;
319
    opc_inj_int_s        <= false;
320
    bus_read_bus_s       <= false;
321
 
322
    need_address_v    := not clk_second_cycle_i or
323
                         (clk_second_cycle_i and assert_psen_s);
324
 
325
    case clk_mstate_i is
326
      when MSTATE1 =>
327
        if need_address_v and not int_pending_s then
328
          if ea_i = '0' then
329
            pm_read_pmem_o  <= true;
330
          else
331
            bus_read_bus_s  <= true;
332 64 arniml
            p2_output_pch_o <= true;
333 4 arniml
          end if;
334
        end if;
335
 
336
        if not clk_second_cycle_i then
337
          if not int_pending_s then
338
            opc_read_bus_s  <= true;
339
          else
340
            opc_inj_int_s   <= true;    -- inject interrupt call
341
          end if;
342
        end if;
343
 
344
      when MSTATE2 =>
345
        if need_address_v and not branch_taken_q and
346
           not int_pending_s then
347
          pm_inc_pc_s       <= true;
348
        end if;
349
 
350
      when MSTATE3 =>
351
        if need_address_v then
352 106 arniml
          -- Theory of operation:
353
          -- Program Memory address is updated at end of State 3 (or end of
354
          -- State 2 in case of a RET). Address information is thus available
355
          -- latest with State 4.
356
          -- This is the time where we need information about access target
357
          -- (internal or external = EA). EA information needs to be stable
358
          -- until end of State 1.
359 4 arniml
          pm_write_pmem_addr_s <= true;
360 64 arniml
        end if;
361 4 arniml
 
362
      when MSTATE4 =>
363 64 arniml
        if ea_i = '1' and
364 134 arniml
           ((not clk_second_cycle_i and assert_psen_s)
365
            or last_cycle_s) then
366 4 arniml
          clk_assert_psen_o <= true;
367 64 arniml
          p2_output_pch_o   <= true;
368
          bus_output_pcl_o  <= true;
369 4 arniml
        end if;
370
 
371
      when MSTATE5 =>
372 64 arniml
        if ea_i = '1' and
373 106 arniml
           (need_address_v or last_cycle_s) then
374 64 arniml
          p2_output_pch_o   <= true;
375 4 arniml
        end if;
376
 
377
      when others =>
378
        -- pragma translate_off
379
        assert false
380
          report "Unkown machine state!"
381
          severity error;
382
        -- pragma translate_on
383
 
384
    end case;
385
 
386
  end process machine_cycle;
387
  --
388
  -----------------------------------------------------------------------------
389
 
390
 
391
  -----------------------------------------------------------------------------
392
  -- Process decode
393
  --
394
  -- Purpose:
395
  --   Indentifies each single instruction and steps through the related
396
  --   execution sequence.
397
  --
398
  decode: process (alu_carry_i,
399 27 arniml
                   psw_aux_carry_i,
400
                   alu_da_overflow_i,
401 4 arniml
                   clk_mstate_i,
402
                   clk_second_cycle_i,
403
                   cnd_take_branch_i,
404
                   opc_opcode_s,
405
                   opc_mnemonic_s,
406
                   psw_carry_i,
407
                   psw_f0_i,
408
                   f1_q,
409
                   mb_q,
410
                   tim_int_s,
411 120 arniml
                   int_pending_s,
412
                   int_in_progress_s)
413 4 arniml
 
414
    procedure address_indirect_3_f is
415
    begin
416
      -- apply dmem address from selected register for indirect mode
417 92 arniml
      if opc_opcode_s(3) = '0' or enable_quartus_bugfix_c then
418 4 arniml
        dm_read_dmem_o       <= true;
419
        dm_write_dmem_addr_o <= true;
420
        dm_addr_type_o       <= DM_PLAIN;
421
      end if;
422
    end;
423
 
424
    procedure and_or_xor_add_4_f is
425
    begin
426
      -- write dmem contents to Temp Reg
427
      dm_read_dmem_o         <= true;
428
      alu_write_temp_reg_o   <= true;
429
    end;
430
 
431
    procedure and_or_xor_add_5_f (alu_op : alu_op_t) is
432
    begin
433
      -- perform ALU operation and store in Accumulator
434
      alu_op_o               <= alu_op;
435
      alu_read_alu_o         <= true;
436
      alu_write_accu_o       <= true;
437
    end;
438
 
439
    procedure cond_jump_c2_m1_f is
440
    begin
441
      -- store address in Program Counter low byte if branch has to
442
      -- be taken
443 92 arniml
--      if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
444 4 arniml
        pm_write_pcl_o       <= true;
445
        branch_taken_s       <= true;
446 92 arniml
--      end if;
447 4 arniml
    end;
448
 
449 120 arniml
    -- intermediate value of the Program Memory Bank Flag
450
    variable mb_v : std_logic;
451
 
452 4 arniml
  begin
453
    -- default assignments
454
    data_s                 <= (others => '-');
455
    read_dec_s             <= false;
456
    branch_taken_s         <= false;
457
    clear_f1_s             <= false;
458
    cpl_f1_s               <= false;
459
    clear_mb_s             <= false;
460
    set_mb_s               <= false;
461
    add_inc_pc_s           <= false;
462
    assert_psen_s          <= false;
463
    stack_high_o           <= false;
464
    alu_write_accu_o       <= false;
465
    alu_write_shadow_o     <= false;
466
    alu_write_temp_reg_o   <= false;
467 27 arniml
    alu_p06_temp_reg_o     <= false;
468
    alu_p60_temp_reg_o     <= false;
469 4 arniml
    alu_read_alu_o         <= false;
470
    bus_write_bus_o        <= false;
471
    bus_bidir_bus_o        <= false;
472
    dm_write_dmem_addr_o   <= false;
473
    dm_write_dmem_s        <= false;
474
    dm_read_dmem_o         <= false;
475
    pm_write_pcl_o         <= false;
476
    pm_read_pcl_o          <= false;
477
    pm_write_pch_o         <= false;
478
    pm_read_pch_o          <= false;
479
    pm_addr_type_o         <= PM_PC;
480
    psw_read_psw_o         <= false;
481
    psw_read_sp_o          <= false;
482
    psw_write_psw_o        <= false;
483
    psw_write_sp_o         <= false;
484
    alu_op_o               <= ALU_NOP;
485
    alu_use_carry_o        <= false;
486 27 arniml
    alu_da_high_o          <= false;
487 38 arniml
    alu_accu_low_o         <= false;
488 4 arniml
    clk_assert_prog_o      <= false;
489
    clk_assert_rd_o        <= false;
490
    clk_assert_wr_o        <= false;
491
    cnd_branch_cond_o      <= COND_ON_BIT;
492
    cnd_compute_take_o     <= false;
493
    cnd_comp_value_o       <= opc_opcode_s(7 downto 5);
494
    dm_addr_type_o         <= DM_REG;
495
    tim_read_timer_o       <= false;
496
    tim_write_timer_o      <= false;
497
    tim_start_t_o          <= false;
498
    tim_start_cnt_o        <= false;
499
    tim_stop_tcnt_o        <= false;
500
    p1_write_p1_o          <= false;
501
    p1_read_p1_o           <= false;
502
    p1_read_reg_o          <= false;
503
    p2_write_p2_o          <= false;
504
    p2_write_exp_o         <= false;
505
    p2_read_p2_o           <= false;
506
    p2_read_reg_o          <= false;
507 21 arniml
    p2_read_exp_o          <= false;
508
    p2_output_exp_o        <= false;
509 4 arniml
    psw_special_data_o     <= '0';
510
    psw_inc_stackp_o       <= false;
511
    psw_dec_stackp_o       <= false;
512
    psw_write_carry_o      <= false;
513
    psw_write_aux_carry_o  <= false;
514
    psw_write_f0_o         <= false;
515
    psw_write_bs_o         <= false;
516
    jtf_executed_s         <= false;
517
    en_tcnti_s             <= false;
518
    dis_tcnti_s            <= false;
519
    en_i_s                 <= false;
520
    dis_i_s                <= false;
521
    retr_executed_s        <= false;
522
    int_executed_s         <= false;
523
    add_write_pmem_addr_s  <= false;
524
    ent0_clk_s             <= false;
525
    add_read_bus_s         <= false;
526
 
527 120 arniml
    -- the Program Memory Bank Flag is held low when interrupts are in progress
528
    -- according to the MCS-48 User's Manual
529
    if int_in_progress_s then
530
      mb_v := '0';
531
    else
532
      mb_v := mb_q;
533
    end if;
534
 
535 4 arniml
    -- prepare potential register indirect address mode
536
    if not clk_second_cycle_i and clk_mstate_i = MSTATE2 then
537
      data_s               <= (others => '0');
538
      if opc_opcode_s(3) = '1' then
539
        data_s(2 downto 0) <= opc_opcode_s(2 downto 0);
540
      else
541
        data_s(2 downto 0) <= "00" & opc_opcode_s(0);
542
      end if;
543
 
544
      read_dec_s           <= true;
545
      dm_write_dmem_addr_o <= true;
546
      dm_addr_type_o       <= DM_REG;
547
    end if;
548
 
549
    case opc_mnemonic_s is
550
 
551
      -- Mnemonic ADD ---------------------------------------------------------
552
      when MN_ADD =>
553
        case clk_mstate_i is
554
          -- read RAM once for indirect address mode
555
          when MSTATE3 =>
556 92 arniml
            if not enable_quartus_bugfix_c or
557
               opc_opcode_s(3) = '0' then
558
              address_indirect_3_f;
559
            end if;
560 4 arniml
 
561
          -- store data from RAM to Temp Reg
562
          when MSTATE4 =>
563
            and_or_xor_add_4_f;
564
 
565
          -- perform ADD and store in Accumulator
566
          when MSTATE5 =>
567
            and_or_xor_add_5_f(alu_op => ALU_ADD);
568
 
569
            if opc_opcode_s(4) = '1' then
570 27 arniml
              alu_use_carry_o     <= true;
571 4 arniml
            end if;
572
 
573 27 arniml
            psw_special_data_o    <= alu_carry_i;
574
            psw_write_carry_o     <= true;
575
            psw_write_aux_carry_o <= true;
576 4 arniml
 
577
          when others =>
578
            null;
579
 
580
        end case;
581
 
582
      -- Mnemonic ADD_A_DATA --------------------------------------------------
583
      when MN_ADD_A_DATA =>
584 27 arniml
        assert_psen_s               <= true;
585 4 arniml
 
586
        if clk_second_cycle_i then
587
          case clk_mstate_i is
588
            -- write Temp Reg when contents of Program Memory is on bus
589
            when MSTATE1 =>
590 27 arniml
              alu_write_temp_reg_o  <= true;
591 4 arniml
 
592
            -- perform ADD and store in Accumulator
593
            when MSTATE3 =>
594
              and_or_xor_add_5_f(alu_op => ALU_ADD);
595
 
596
              if opc_opcode_s(4) = '1' then
597 27 arniml
                alu_use_carry_o     <= true;
598 4 arniml
              end if;
599
 
600 27 arniml
              psw_special_data_o    <= alu_carry_i;
601
              psw_write_carry_o     <= true;
602
              psw_write_aux_carry_o <= true;
603 4 arniml
 
604
            when others =>
605
              null;
606
 
607
          end case;
608
 
609
        end if;
610
 
611
      -- Mnemonic ANL ---------------------------------------------------------
612
      when MN_ANL =>
613
        case clk_mstate_i is
614
          -- read RAM once for indirect address mode
615
          when MSTATE3 =>
616 92 arniml
            if not enable_quartus_bugfix_c or
617
               opc_opcode_s(3) = '0' then
618
              address_indirect_3_f;
619
            end if;
620 4 arniml
 
621
          -- store data from RAM to Temp Reg
622
          when MSTATE4 =>
623
            and_or_xor_add_4_f;
624
 
625
          -- perform AND and store in Accumulator
626
          when MSTATE5 =>
627
            and_or_xor_add_5_f(alu_op => ALU_AND);
628
 
629
          when others =>
630
            null;
631
 
632
        end case;
633
 
634
      -- Mnemonic ANL_A_DATA --------------------------------------------------
635
      when MN_ANL_A_DATA =>
636
        assert_psen_s              <= true;
637
 
638
        if clk_second_cycle_i then
639
          case clk_mstate_i is
640
            -- write Temp Reg when contents of Program Memory is on bus
641
            when MSTATE1 =>
642
              alu_write_temp_reg_o <= true;
643
 
644
            -- perform AND and store in Accumulator
645
            when MSTATE3 =>
646
              and_or_xor_add_5_f(alu_op => ALU_AND);
647
 
648
            when others =>
649
              null;
650
 
651
          end case;
652
 
653
        end if;
654
 
655
      -- Mnemonic ANL_EXT -----------------------------------------------------
656
      when MN_ANL_EXT =>
657
        assert_psen_s            <= true;
658
 
659
        if not clk_second_cycle_i then
660
          -- read port to Temp Reg
661
          if clk_mstate_i = MSTATE5 then
662
            if opc_opcode_s(1 downto 0) = "00" then
663
              add_read_bus_s     <= true;
664
            elsif opc_opcode_s(1) = '0' then
665
              p1_read_p1_o       <= true;
666
              p1_read_reg_o      <= true;
667
            else
668
              p2_read_p2_o       <= true;
669
              p2_read_reg_o      <= true;
670
            end if;
671
 
672
            alu_write_temp_reg_o <= true;
673
          end if;
674
 
675
        else
676
          case clk_mstate_i is
677
            -- write shadow Accumulator when contents of Program Memory is
678
            -- on bus
679
            when MSTATE1 =>
680
              alu_write_shadow_o <= true;
681
 
682
            -- loop shadow Accumulator through ALU to prevent update from
683
            -- real Accumulator
684
            when MSTATE2 =>
685
              alu_read_alu_o     <= true;
686
              alu_write_shadow_o <= true;
687
 
688
            -- write result of AND operation back to port
689
            when MSTATE3 =>
690
              alu_op_o           <= ALU_AND;
691
              alu_read_alu_o     <= true;
692
 
693
              if opc_opcode_s(1 downto 0) = "00" then
694
                bus_write_bus_o  <= true;
695
              elsif opc_opcode_s(1) = '0' then
696
                p1_write_p1_o    <= true;
697
              else
698
                p2_write_p2_o    <= true;
699
              end if;
700
 
701
            when others =>
702
              null;
703
 
704
          end case;
705
 
706
        end if;
707
 
708
      -- Mnemonic CALL --------------------------------------------------------
709
      when MN_CALL =>
710
        assert_psen_s              <= true;
711
 
712
        if not clk_second_cycle_i then
713
          case clk_mstate_i is
714
            -- read Stack Pointer and address Data Memory for low byte
715
            -- also increment Program Counter to point to next instruction
716
            when MSTATE3 =>
717
              psw_read_sp_o        <= true;
718
              dm_write_dmem_addr_o <= true;
719
              dm_addr_type_o       <= DM_STACK;
720
 
721
              -- only increment PC if this is not an injected CALL
722
              -- injected CALLS are not located in Program Memory,
723
              -- the PC points already to the instruction to be executed
724
              -- after the interrupt
725
              if not int_pending_s then
726
                add_inc_pc_s       <= true;
727
              end if;
728
 
729
            -- store Program Counter low byte on stack
730
            when MSTATE4 =>
731
              pm_read_pcl_o        <= true;
732
              dm_write_dmem_s      <= true;
733
 
734
            -- store Program Counter high byte and PSW on stack
735
            -- increment Stack pointer
736
            when MSTATE5 =>
737
              psw_read_psw_o       <= true;
738
              pm_read_pch_o        <= true;
739
              dm_write_dmem_addr_o <= true;
740
              dm_addr_type_o       <= DM_STACK_HIGH;
741
              dm_write_dmem_s      <= true;
742
              psw_inc_stackp_o     <= true;
743
 
744
            when others =>
745
              null;
746
 
747
          end case;
748
 
749
        else
750
          case clk_mstate_i is
751
            -- store address in Program Counter low byte
752
            when MSTATE1 =>
753
              pm_write_pcl_o       <= true;
754
              branch_taken_s       <= true;
755
              if int_pending_s then
756
                -- apply low part of vector address manually
757
                data_s             <= (others => '0');
758
                data_s(1 downto 0) <= "11";
759
                if tim_int_s then
760
                  data_s(2)        <= '1';
761
                end if;
762
                read_dec_s         <= true;
763
              end if;
764
 
765
            when MSTATE2 =>
766
              pm_write_pch_o       <= true;
767
              read_dec_s           <= true;
768
              if not int_pending_s then
769
                -- store high part of target address in Program Counter
770 120 arniml
                data_s             <= "0000" & mb_v & opc_opcode_s(7 downto 5);
771 4 arniml
              else
772
                -- apply high part of vector address manually
773
                data_s             <= (others => '0');
774
                int_executed_s     <= true;
775
              end if;
776
 
777
            when others =>
778
              null;
779
 
780
          end case;
781
 
782
        end if;
783
 
784
      -- Mnemonic CLR_A -------------------------------------------------------
785
      when MN_CLR_A =>
786
        -- write CLR output of ALU to Accumulator
787
        if clk_mstate_i = MSTATE3 then
788
          alu_op_o         <= ALU_CLR;
789
          alu_read_alu_o   <= true;
790
          alu_write_accu_o <= true;
791
        end if;
792
 
793
      -- Mnemonic CLR_C -------------------------------------------------------
794
      when MN_CLR_C =>
795
        -- store 0 to Carry
796
        if clk_mstate_i = MSTATE3 then
797
          psw_special_data_o <= '0';
798
          psw_write_carry_o  <= true;
799
        end if;
800
 
801
      -- Mnemonic CLR_F -------------------------------------------------------
802
      when MN_CLR_F =>
803
        -- store 0 to selected flag
804
        if clk_mstate_i = MSTATE3 then
805
          if opc_opcode_s(5) = '0' then
806
            psw_special_data_o <= '0';
807
            psw_write_f0_o     <= true;
808
          else
809
            clear_f1_s         <= true;
810
          end if;
811
 
812
        end if;
813
 
814
      -- Mnemonic CPL_A -------------------------------------------------------
815
      when MN_CPL_A =>
816
        -- write CPL output of ALU to Accumulator
817
        if clk_mstate_i = MSTATE3 then
818
          alu_op_o         <= ALU_CPL;
819
          alu_read_alu_o   <= true;
820
          alu_write_accu_o <= true;
821
        end if;
822
 
823
      -- Mnemnonic CPL_C ------------------------------------------------------
824
      when MN_CPL_C =>
825
        -- write inverse of Carry to PSW
826
        if clk_mstate_i = MSTATE3 then
827
          psw_special_data_o <= not psw_carry_i;
828
          psw_write_carry_o  <= true;
829
        end if;
830
 
831
      -- Mnemonic CPL_F -------------------------------------------------------
832
      when MN_CPL_f =>
833
        -- write inverse of selected flag back to flag
834
        if clk_mstate_i = MSTATE3 then
835
          if opc_opcode_s(5) = '0' then
836
            psw_special_data_o <= not psw_f0_i;
837
            psw_write_f0_o     <= true;
838
          else
839
            cpl_f1_s           <= true;
840
          end if;
841
 
842
        end if;
843
 
844 27 arniml
      -- Mnemonic DA ----------------------------------------------------------
845
      when MN_DA =>
846
        alu_op_o                 <= ALU_ADD;
847
 
848
        case clk_mstate_i is
849
          -- Step 1: Preload Temp Reg with 0x06
850
          when MSTATE3 =>
851
            alu_p06_temp_reg_o   <= true;
852
 
853
          -- Step 2: Check Auxiliary Carry and overflow on low nibble
854
          --         Add 0x06 to shadow Accumulator if one is true
855
          when MSTATE4 =>
856
            if psw_aux_carry_i = '1' or alu_da_overflow_i then
857
              alu_read_alu_o     <= true;
858
              alu_write_shadow_o <= true;
859
            end if;
860
 
861
            -- preload Temp Reg with 0x60
862
            alu_p60_temp_reg_o  <= true;
863
 
864
          -- Step 3: Check overflow on high nibble
865
          --         Add 0x60 to shadow Accumulator if true and store result
866
          --         in Accumulator and PSW (only Carry)
867
          when MSTATE5 =>
868
            alu_da_high_o        <= true;
869
 
870
            if alu_da_overflow_i then
871
              psw_special_data_o <= alu_carry_i;
872
            else
873
              alu_op_o           <= ALU_NOP;
874
              psw_special_data_o <= '0';
875
            end if;
876
            alu_read_alu_o       <= true;
877
            alu_write_accu_o     <= true;
878
            psw_write_carry_o    <= true;
879
 
880
          when others =>
881
            null;
882
 
883
        end case;
884
 
885 4 arniml
      -- Mnemonic DEC ---------------------------------------------------------
886
      when MN_DEC =>
887
        case clk_mstate_i is
888
          when MSTATE4 =>
889
            -- DEC Rr: store data from RAM to shadow Accumulator
890
            if opc_opcode_s(6) = '1' then
891
              dm_read_dmem_o         <= true;
892
              alu_write_shadow_o     <= true;
893
            end if;
894
 
895
          when MSTATE5 =>
896
            alu_op_o                 <= ALU_DEC;
897
            alu_read_alu_o           <= true;
898
 
899
            if opc_opcode_s(6) = '0' then
900
              -- write DEC of Accumulator to Accumulator
901
              alu_write_accu_o       <= true;
902
            else
903
              -- store DEC of shadow Accumulator back to dmem
904
              dm_write_dmem_s        <= true;
905
            end if;
906
 
907
          when others =>
908
            null;
909
 
910
        end case;
911
 
912
      -- Mnemonic DIS_EN_I ----------------------------------------------------
913
      when MN_DIS_EN_I =>
914
        if clk_mstate_i = MSTATE3 then
915
          if opc_opcode_s(4) = '1' then
916
            dis_i_s <= true;
917
          else
918
            en_i_s  <= true;
919
          end if;
920
        end if;
921
 
922
      -- Mnemonic DIS_EN_TCNTI ------------------------------------------------
923
      when MN_DIS_EN_TCNTI =>
924
        if clk_mstate_i = MSTATE3 then
925
          if opc_opcode_s(4) = '1' then
926
            dis_tcnti_s <= true;
927
          else
928
            en_tcnti_s  <= true;
929
          end if;
930
        end if;
931
 
932
      -- Mnemonic DJNZ --------------------------------------------------------
933
      when MN_DJNZ =>
934
        assert_psen_s              <= true;
935
 
936
        if not clk_second_cycle_i then
937
          case clk_mstate_i is
938
            -- store data from RAM to shadow Accumulator
939
            when MSTATE4 =>
940
              dm_read_dmem_o         <= true;
941
              alu_write_shadow_o     <= true;
942
 
943
            -- write DEC result of shadow Accumulator back to dmem and
944
            -- conditional branch logic
945
            when MSTATE5 =>
946
              alu_op_o               <= ALU_DEC;
947
              alu_read_alu_o         <= true;
948
              dm_write_dmem_s        <= true;
949
 
950
              cnd_compute_take_o     <= true;
951
              cnd_branch_cond_o      <= COND_Z;
952
              cnd_comp_value_o(0)    <= '0';
953
 
954
            when others =>
955
              null;
956
 
957
          end case;
958
 
959
        else
960
          -- store address in Program Counter low byte if branch has to
961
          -- be taken
962 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
963
            cond_jump_c2_m1_f;
964
          end if;
965 4 arniml
 
966
        end if;
967
 
968
      -- Mnemonic ENT0_CLK ----------------------------------------------------
969
      when MN_ENT0_CLK =>
970
        if clk_mstate_i = MSTATE3 then
971
          ent0_clk_s <= true;
972
        end if;
973
 
974
      -- Mnemonic IN ----------------------------------------------------------
975
      when MN_IN =>
976
        -- read Port and store in Accumulator
977
        if clk_second_cycle_i and clk_mstate_i = MSTATE2 then
978
          alu_write_accu_o <= true;
979
 
980
          if opc_opcode_s(1) = '0' then
981
            p1_read_p1_o   <= true;
982
          else
983
            p2_read_p2_o   <= true;
984
          end if;
985
        end if;
986
 
987
      -- Mnemonic INS ---------------------------------------------------------
988
      when MN_INS =>
989
        -- read BUS and store in Accumulator
990
        if clk_second_cycle_i and clk_mstate_i = MSTATE2 then
991
          alu_write_accu_o <= true;
992
 
993
          add_read_bus_s   <= true;
994
        end if;
995
 
996
      -- Mnemonic INC ---------------------------------------------------------
997
      when MN_INC =>
998
        case clk_mstate_i is
999
          -- read RAM once for indirect address mode
1000
          when MSTATE3 =>
1001 92 arniml
            if not enable_quartus_bugfix_c or
1002
               opc_opcode_s(3) = '0' then
1003
              address_indirect_3_f;
1004
            end if;
1005 4 arniml
 
1006
          when MSTATE4 =>
1007
            -- INC Rr; INC @ Rr: store data from RAM to shadow Accumulator
1008
            if opc_opcode_s(3 downto 2) /= "01" then
1009
              dm_read_dmem_o         <= true;
1010
              alu_write_shadow_o     <= true;
1011
            end if;
1012
 
1013
          when MSTATE5 =>
1014
            alu_op_o                 <= ALU_INC;
1015
            alu_read_alu_o           <= true;
1016
 
1017
            if opc_opcode_s(3 downto 2) = "01" then
1018
              -- write INC output of ALU to Accumulator
1019
              alu_write_accu_o       <= true;
1020
            else
1021
              -- store INC of shadow Accumulator back to dmem
1022
              dm_write_dmem_s        <= true;
1023
            end if;
1024
 
1025
          when others =>
1026
            null;
1027
 
1028
        end case;
1029
 
1030
      -- Mnemonic JBB ---------------------------------------------------------
1031
      when MN_JBB =>
1032
        assert_psen_s          <= true;
1033
        cnd_branch_cond_o      <= COND_ON_BIT;
1034
 
1035
        if not clk_second_cycle_i then
1036
          -- read Accumulator and start branch calculation
1037
          if clk_mstate_i = MSTATE3 then
1038
            alu_read_alu_o     <= true;
1039
            cnd_compute_take_o <= true;
1040
            -- cnd_comp_value_o is ok by default assignment
1041
          end if;
1042
 
1043
        else
1044
          -- store address in Program Counter low byte if branch has to
1045
          -- be taken
1046 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1047
            cond_jump_c2_m1_f;
1048
          end if;
1049 4 arniml
 
1050
        end if;
1051
 
1052
      -- Mnemonic JC ----------------------------------------------------------
1053
      when MN_JC =>
1054
        assert_psen_s           <= true;
1055
        cnd_branch_cond_o       <= COND_C;
1056
 
1057
        if not clk_second_cycle_i then
1058
          -- start branch calculation
1059
          if clk_mstate_i = MSTATE3 then
1060
            cnd_compute_take_o  <= true;
1061
            cnd_comp_value_o(0) <= opc_opcode_s(4);
1062
          end if;
1063
 
1064
        else
1065
          -- store address in Program Counter low byte if branch has to
1066
          -- be taken
1067 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1068
            cond_jump_c2_m1_f;
1069
          end if;
1070 4 arniml
 
1071
        end if;
1072
 
1073
      -- Mnemonic JF ----------------------------------------------------------
1074
      when MN_JF =>
1075
        assert_psen_s           <= true;
1076
 
1077
        if not clk_second_cycle_i then
1078
          -- start branch calculation
1079
          if clk_mstate_i = MSTATE3 then
1080
            cnd_compute_take_o  <= true;
1081
            if opc_opcode_s(7) = '1' then
1082
              -- JF0
1083
              cnd_branch_cond_o <= COND_F0;
1084
            else
1085
              -- JF1
1086
              cnd_branch_cond_o <= COND_F1;
1087
            end if;
1088
 
1089
          end if;
1090
 
1091
        else
1092
          -- store address in Program Counter low byte if branch has to
1093
          -- be taken
1094 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1095
            cond_jump_c2_m1_f;
1096
          end if;
1097 4 arniml
 
1098
        end if;
1099
 
1100
 
1101
      -- Mnemonic JMP ---------------------------------------------------------
1102
      when MN_JMP =>
1103
        assert_psen_s        <= true;
1104
 
1105
        if clk_second_cycle_i then
1106
          case clk_mstate_i is
1107
            -- store address in Program Counter low byte
1108
            when MSTATE1 =>
1109
              pm_write_pcl_o <= true;
1110
              branch_taken_s <= true;
1111
 
1112
            -- store high part of target address in Program Counter
1113
            when MSTATE2 =>
1114 120 arniml
              data_s         <= "0000" & mb_v & opc_opcode_s(7 downto 5);
1115 4 arniml
              read_dec_s     <= true;
1116
              pm_write_pch_o <= true;
1117
 
1118
            when others =>
1119
              null;
1120
 
1121
          end case;
1122
 
1123
        end if;
1124
 
1125
      -- Mnemonic JMPP --------------------------------------------------------
1126
      when MN_JMPP =>
1127
        assert_psen_s    <= true;
1128
 
1129
        if not clk_second_cycle_i then
1130
          -- write Accumulator to Program Memory address
1131
          -- (skip page offset update from Program Counter)
1132
          if clk_mstate_i = MSTATE3 then
1133
            alu_read_alu_o <= true;
1134
            pm_addr_type_o <= PM_PAGE;
1135
          end if;
1136
 
1137
        else
1138
          if clk_mstate_i = MSTATE1 then
1139
            -- store address in Program Counter low byte
1140
            pm_write_pcl_o <= true;
1141
            branch_taken_s <= true;
1142
          end if;
1143
 
1144
        end if;
1145
 
1146
      -- Mnemonic JNI ---------------------------------------------------------
1147
      when MN_JNI =>
1148
        assert_psen_s          <= true;
1149
        cnd_branch_cond_o      <= COND_INT;
1150
 
1151
        if not clk_second_cycle_i then
1152
          -- start branch calculation
1153
          if clk_mstate_i = MSTATE3 then
1154
            cnd_compute_take_o <= true;
1155
          end if;
1156
 
1157
        else
1158
          -- store address in Program Counter low byte if branch has to
1159
          -- be taken
1160 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1161
            cond_jump_c2_m1_f;
1162
          end if;
1163 4 arniml
 
1164
        end if;
1165
 
1166
      -- Mnemonic JT ----------------------------------------------------------
1167
      when MN_JT =>
1168
        assert_psen_s           <= true;
1169
        if opc_opcode_s(6) = '0' then
1170
          cnd_branch_cond_o     <= COND_T0;
1171
        else
1172
          cnd_branch_cond_o     <= COND_T1;
1173
        end if;
1174
 
1175
        if not clk_second_cycle_i then
1176
          -- start branch calculation
1177
          if clk_mstate_i = MSTATE3 then
1178
            cnd_compute_take_o  <= true;
1179
            cnd_comp_value_o(0) <= opc_opcode_s(4);
1180
          end if;
1181
 
1182
        else
1183
          -- store address in Program Counter low byte if branch has to
1184
          -- be taken
1185 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1186
            cond_jump_c2_m1_f;
1187
          end if;
1188 4 arniml
 
1189
        end if;
1190
 
1191
      -- Mnemonic JTF ---------------------------------------------------------
1192
      when MN_JTF =>
1193
        assert_psen_s          <= true;
1194
        cnd_branch_cond_o      <= COND_TF;
1195
 
1196
        if not clk_second_cycle_i then
1197
          -- start branch calculation
1198
          if clk_mstate_i = MSTATE3 then
1199
            cnd_compute_take_o <= true;
1200
            jtf_executed_s     <= true;
1201
          end if;
1202
 
1203
        else
1204
          -- store address in Program Counter low byte if branch has to
1205
          -- be taken
1206 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1207
            cond_jump_c2_m1_f;
1208
          end if;
1209 4 arniml
 
1210
        end if;
1211
 
1212
      -- Mnemonic JZ ----------------------------------------------------------
1213
      when MN_JZ =>
1214
        assert_psen_s           <= true;
1215
        cnd_branch_cond_o       <= COND_Z;
1216
 
1217
        if not clk_second_cycle_i then
1218
          -- read Accumulator and start branch calculation
1219
          if clk_mstate_i = MSTATE3 then
1220
            alu_read_alu_o      <= true;
1221
            cnd_compute_take_o  <= true;
1222
            cnd_comp_value_o(0) <= opc_opcode_s(6);
1223
          end if;
1224
 
1225
        else
1226
          -- store address in Program Counter low byte if branch has to
1227
          -- be taken
1228 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1229
            cond_jump_c2_m1_f;
1230
          end if;
1231 4 arniml
 
1232
        end if;
1233
 
1234
      -- Mnemonic MOV_A_DATA --------------------------------------------------
1235
      when MN_MOV_A_DATA =>
1236
        assert_psen_s      <= true;
1237
 
1238
        -- Write Accumulator when contents of Program Memory is on bus
1239
        -- during machine state 1 of second cycle.
1240
        if clk_second_cycle_i and clk_mstate_i = MSTATE1 then
1241
          alu_write_accu_o <= true;
1242
        end if;
1243
 
1244
      -- Mnemonic MOV_A_RR ----------------------------------------------------
1245
      when MN_MOV_A_RR =>
1246
        case clk_mstate_i is
1247
          -- read RAM once for indirect address mode
1248
          when MSTATE3 =>
1249 92 arniml
            if not enable_quartus_bugfix_c or
1250
               opc_opcode_s(3) = '0' then
1251
              address_indirect_3_f;
1252
            end if;
1253 4 arniml
 
1254
          -- read data from RAM and store in Accumulator
1255
          when MSTATE4 =>
1256
            and_or_xor_add_4_f;
1257
            alu_write_accu_o <= true;
1258
 
1259
          when others =>
1260
            null;
1261
 
1262
        end case;
1263
 
1264
      -- Mnemonic MOV_A_PSW ---------------------------------------------------
1265
      when MN_MOV_A_PSW =>
1266
        if clk_mstate_i = MSTATE3 then
1267
          psw_read_psw_o   <= true;
1268
          psw_read_sp_o    <= true;
1269
          alu_write_accu_o <= true;
1270
        end if;
1271
 
1272
      -- Mnemoniv MOV_PSW_A ---------------------------------------------------
1273
      when MN_MOV_PSW_A =>
1274
        if clk_mstate_i = MSTATE3 then
1275
          alu_read_alu_o  <= true;
1276
          psw_write_psw_o <= true;
1277
          psw_write_sp_o  <= true;
1278
        end if;
1279
 
1280
      -- Mnemonic MOV_RR ------------------------------------------------------
1281
      when MN_MOV_RR =>
1282
        case clk_mstate_i is
1283
          -- read RAM once for indirect address mode
1284
          when MSTATE3 =>
1285 92 arniml
            if not enable_quartus_bugfix_c or
1286
               opc_opcode_s(3) = '0' then
1287
              address_indirect_3_f;
1288
            end if;
1289 4 arniml
 
1290
          -- write Accumulator to dmem
1291
          when MSTATE5 =>
1292
            alu_read_alu_o       <= true;
1293
            dm_write_dmem_s      <= true;
1294
 
1295
          when others =>
1296
            null;
1297
 
1298
        end case;
1299
 
1300
      -- Mnemonic MOV_RR_DATA -------------------------------------------------
1301
      when MN_MOV_RR_DATA =>
1302
        assert_psen_s     <= true;
1303
 
1304
        -- read RAM once for indirect address mode
1305
        if not clk_second_cycle_i and clk_mstate_i = MSTATE3 then
1306 92 arniml
          if not enable_quartus_bugfix_c or
1307
             opc_opcode_s(3) = '0' then
1308
            address_indirect_3_f;
1309
          end if;
1310 4 arniml
        end if;
1311
 
1312
        -- Write Data Memory when contents of Program Memory is on bus
1313
        -- during machine state 1 of second cycle.
1314
        if clk_second_cycle_i and clk_mstate_i = MSTATE1 then
1315
          dm_write_dmem_s <= true;
1316
        end if;
1317
 
1318
      -- Mnemonic MOV_T -------------------------------------------------------
1319
      when MN_MOV_T =>
1320
        if clk_mstate_i = MSTATE3 then
1321
          if opc_opcode_s(5) = '1' then
1322
            alu_read_alu_o    <= true;  -- MOV T, A
1323
            tim_write_timer_o <= true;
1324
          else
1325
            tim_read_timer_o  <= true;  -- MOV A, T
1326
            alu_write_accu_o  <= true;
1327
          end if;
1328
        end if;
1329
 
1330 21 arniml
      -- Mnemonic OUTD_PP_A ---------------------------------------------------
1331
      when MN_OUTD_PP_A =>
1332
        clk_assert_prog_o     <= true;
1333
 
1334
        if not clk_second_cycle_i then
1335
          case clk_mstate_i is
1336
            -- propagate expander port number to Port 2
1337
            when MSTATE3 =>
1338
 
1339
              data_s(7 downto 4)     <= (others => '0');
1340
              data_s(1 downto 0)     <= opc_opcode_s(1 downto 0);
1341
              -- decide which 8243 command to use
1342
              case opc_opcode_s(7 downto 4) is
1343
                when "1001" =>
1344
                  data_s(3 downto 2) <= "11";  -- ANLD command
1345
                when "1000" =>
1346
                  data_s(3 downto 2) <= "10";  -- ORLD command
1347
                when "0011" =>
1348
                  data_s(3 downto 2) <= "01";  -- MOVD command
1349
                when others =>
1350
                  null;
1351
              end case;
1352
 
1353
              read_dec_s      <= true;
1354
              p2_write_exp_o  <= true;
1355
 
1356
            -- output expander port number on Port 2 while active edge of PROG
1357
            -- write Accumulator to expander port
1358
            when MSTATE4 =>
1359
              p2_output_exp_o <= true;
1360
 
1361
              alu_read_alu_o  <= true;
1362
              p2_write_exp_o  <= true;
1363
 
1364
            when MSTATE5 =>
1365
              p2_output_exp_o <= true;
1366
 
1367
            when others =>
1368
              null;
1369
 
1370
          end case;
1371
 
1372
        else
1373
          -- hold expander port until inactive edge of PROG 
1374
          if clk_mstate_i = MSTATE1 or clk_mstate_i = MSTATE2 then
1375
            p2_output_exp_o   <= true;
1376
          end if;
1377
 
1378
        end if;
1379
 
1380
      -- Mnemonic MOVD_A_PP ---------------------------------------------------
1381
      when MN_MOVD_A_PP =>
1382
        clk_assert_prog_o            <= true;
1383
 
1384
        if not clk_second_cycle_i then
1385
          case clk_mstate_i is
1386
            -- propagate expander port number to Port 2
1387
            when MSTATE3 =>
1388
              data_s                 <= "0000" &
1389
                                        "00"   &  -- 8243 command: read
1390
                                        opc_opcode_s(1 downto 0);
1391
              read_dec_s             <= true;
1392
              p2_write_exp_o         <= true;
1393
 
1394
            -- output expander port number on Port 2 while active edge of PROG
1395
            -- write 1's to expander port to set lower nibble of Port 2 to input
1396
            when MSTATE4 =>
1397
              p2_output_exp_o        <= true;
1398
 
1399
              data_s(nibble_t'range) <= (others => '1');
1400
              read_dec_s             <= true;
1401
              p2_write_exp_o         <= true;
1402
 
1403
            when MSTATE5 =>
1404
              p2_output_exp_o        <= true;
1405
 
1406
            when others =>
1407
              null;
1408
 
1409
          end case;
1410
 
1411
        else
1412
          case clk_mstate_i is
1413
            -- hold expander port until inactive edge of PROG
1414
            when MSTATE1 =>
1415
              p2_output_exp_o  <= true;
1416
 
1417
            -- hold expander port until inactive edge of PROG
1418
            -- write Accumulator with nibble of expander port
1419
            when MSTATE2 =>
1420 101 arniml
              p2_read_p2_o     <= true;
1421 21 arniml
              p2_output_exp_o  <= true;
1422
              p2_read_exp_o    <= true;
1423
              alu_write_accu_o <= true;
1424
 
1425
            when others =>
1426
              null;
1427
 
1428
          end case;
1429
 
1430
        end if;
1431
 
1432 4 arniml
      -- Mnemonic MOVP --------------------------------------------------------
1433
      when MN_MOVP =>
1434
        assert_psen_s        <= true;
1435
 
1436
        if not clk_second_cycle_i then
1437
          -- write Accumulator to Program Memory address
1438
          -- (skip page offset update from Program Counter)
1439
          if clk_mstate_i = MSTATE3 then
1440
            alu_read_alu_o   <= true;
1441
            if opc_opcode_s(6) = '0' then
1442
              pm_addr_type_o <= PM_PAGE;
1443
            else
1444
              pm_addr_type_o <= PM_PAGE3;
1445
            end if;
1446
          end if;
1447
 
1448
        else
1449
          if clk_mstate_i = MSTATE1 then
1450
            -- store data from Program Memory in Accumulator
1451
            alu_write_accu_o <= true;
1452
            -- trick & treat to prevent additional PC increment
1453
            -- our branch target is the previously incremented PC!
1454
            branch_taken_s   <= true;
1455
          end if;
1456
 
1457
        end if;
1458
 
1459
      -- Mnemonic MOVX --------------------------------------------------------
1460
      when MN_MOVX =>
1461
        bus_bidir_bus_o        <= true;
1462
 
1463
        if opc_opcode_s(4) = '0' then
1464
          clk_assert_rd_o      <= true;
1465
        else
1466
          clk_assert_wr_o      <= true;
1467
        end if;
1468
 
1469
        if not clk_second_cycle_i then
1470 78 arniml
          case clk_mstate_i is
1471
            -- read dmem and put contents on BUS as external address
1472
            when MSTATE3 =>
1473
              dm_read_dmem_o     <= true;
1474
              bus_write_bus_o    <= true;
1475 4 arniml
 
1476 78 arniml
            -- store contents of Accumulator to BUS
1477
            when MSTATE5 =>
1478
              if opc_opcode_s(4) = '1' then
1479
                alu_read_alu_o   <= true;
1480
                bus_write_bus_o  <= true;
1481
              end if;
1482
 
1483
            when others =>
1484
              null;
1485
          end case;
1486
 
1487 4 arniml
        else
1488
          if clk_mstate_i = MSTATE1 then
1489
            if opc_opcode_s(4) = '0' then
1490
              -- store contents of BUS in Accumulator
1491
              add_read_bus_s   <= true;
1492
              alu_write_accu_o <= true;
1493
            else
1494
              -- store contents of Accumulator to BUS
1495
              alu_read_alu_o   <= true;
1496
              bus_write_bus_o  <= true;
1497
            end if;
1498
          end if;
1499
 
1500
        end if;
1501
 
1502
      -- Mnemonic NOP ---------------------------------------------------------
1503
      when MN_NOP =>
1504
        -- nothing to do
1505
 
1506
      -- Mnemonic ORL ---------------------------------------------------------
1507
      when MN_ORL =>
1508
        case clk_mstate_i is
1509
          -- read RAM once for indirect address mode
1510
          when MSTATE3 =>
1511 92 arniml
            if not enable_quartus_bugfix_c or
1512
               opc_opcode_s(3) = '0' then
1513
              address_indirect_3_f;
1514
            end if;
1515 4 arniml
 
1516
          -- store data from RAM to Temp Reg
1517
          when MSTATE4 =>
1518
            and_or_xor_add_4_f;
1519
 
1520
          -- perform OR and store in Accumulator
1521
          when MSTATE5 =>
1522
            and_or_xor_add_5_f(alu_op => ALU_OR);
1523
 
1524
          when others =>
1525
            null;
1526
 
1527
        end case;
1528
 
1529
      -- Mnemonic ORL_A_DATA --------------------------------------------------
1530
      when MN_ORL_A_DATA =>
1531
        assert_psen_s              <= true;
1532
 
1533
        if clk_second_cycle_i then
1534
          case clk_mstate_i is
1535
            -- write Temp Reg when contents of Program Memory is on bus
1536
            when MSTATE1 =>
1537
              alu_write_temp_reg_o <= true;
1538
 
1539
            -- perform OR and store in Accumulator
1540
            when MSTATE3 =>
1541
              and_or_xor_add_5_f(alu_op => ALU_OR);
1542
 
1543
            when others =>
1544
              null;
1545
 
1546
          end case;
1547
 
1548
        end if;
1549
 
1550
      -- Mnemonic ORL_EXT -----------------------------------------------------
1551
      when MN_ORL_EXT =>
1552
        assert_psen_s            <= true;
1553
 
1554
        if not clk_second_cycle_i then
1555
          -- read port to Temp Reg
1556
          if clk_mstate_i = MSTATE5 then
1557
            if opc_opcode_s(1 downto 0) = "00" then
1558
              add_read_bus_s     <= true;
1559
            elsif opc_opcode_s(1) = '0' then
1560
              p1_read_p1_o       <= true;
1561
              p1_read_reg_o      <= true;
1562
            else
1563
              p2_read_p2_o       <= true;
1564
              p2_read_reg_o      <= true;
1565
            end if;
1566
 
1567
            alu_write_temp_reg_o <= true;
1568
          end if;
1569
 
1570
        else
1571
          case clk_mstate_i is
1572
            -- write shadow Accumulator when contents of Program Memory is
1573
            -- on bus
1574
            when MSTATE1 =>
1575
              alu_write_shadow_o <= true;
1576
 
1577
            -- loop shadow Accumulator through ALU to prevent update from
1578
            -- real Accumulator
1579
            when MSTATE2 =>
1580
              alu_read_alu_o     <= true;
1581
              alu_write_shadow_o <= true;
1582
 
1583
            -- write result of OR operation back to port
1584
            when MSTATE3 =>
1585
              alu_op_o           <= ALU_OR;
1586
              alu_read_alu_o     <= true;
1587
 
1588
              if opc_opcode_s(1 downto 0) = "00" then
1589
                bus_write_bus_o  <= true;
1590
              elsif opc_opcode_s(1) = '0' then
1591
                p1_write_p1_o    <= true;
1592
              else
1593
                p2_write_p2_o    <= true;
1594
              end if;
1595
 
1596
            when others =>
1597
              null;
1598
 
1599
          end case;
1600
 
1601
        end if;
1602
 
1603
      -- Mnemonic OUTL_EXT ----------------------------------------------------
1604
      when MN_OUTL_EXT =>
1605
        -- read Accumulator and store in Port/BUS output register
1606
        if clk_second_cycle_i and clk_mstate_i = MSTATE4 then
1607
          alu_read_alu_o  <= true;
1608
 
1609
          if opc_opcode_s(4) = '1' then
1610
            if opc_opcode_s(1) = '0' then
1611
              p1_write_p1_o <= true;
1612
            else
1613
              p2_write_p2_o <= true;
1614
            end if;
1615
 
1616
          else
1617
            bus_write_bus_o <= true;
1618
 
1619
          end if;
1620
 
1621
        end if;
1622
 
1623
      -- Mnemonic RET ---------------------------------------------------------
1624
      when MN_RET =>
1625
        if not clk_second_cycle_i then
1626
          case clk_mstate_i is
1627
            -- decrement Stack Pointer
1628
            when MSTATE3 =>
1629
              psw_dec_stackp_o     <= true;
1630
 
1631
            -- read Stack Pointer and address Data Memory for low byte
1632
            when MSTATE4 =>
1633
              psw_read_sp_o        <= true;
1634
              dm_write_dmem_addr_o <= true;
1635
              dm_addr_type_o       <= DM_STACK;
1636
 
1637
            -- read Data Memory and store to Program Counter low
1638
            -- prepare address to Data memory for high byte
1639
            when MSTATE5 =>
1640
              dm_read_dmem_o       <= true;
1641
              pm_write_pcl_o       <= true;
1642
              dm_write_dmem_addr_o <= true;
1643
              dm_addr_type_o       <= DM_STACK_HIGH;
1644
 
1645
            when others =>
1646
              null;
1647
 
1648
          end case;
1649
 
1650
        else
1651
          case clk_mstate_i is
1652
            -- read Data Memory and store to Program Counter high and PSW
1653
            when MSTATE1 =>
1654
              dm_read_dmem_o         <= true;
1655
              pm_write_pch_o         <= true;
1656
              if opc_opcode_s(4) = '1' then
1657
                psw_write_psw_o      <= true;
1658
                retr_executed_s      <= true;
1659
              end if;
1660
 
1661
            when MSTATE2 =>
1662
              add_write_pmem_addr_s  <= true;
1663
 
1664
            when others =>
1665
              null;
1666
 
1667
          end case;
1668
 
1669
        end if;
1670
 
1671
      -- Mnemonic RL ----------------------------------------------------------
1672
      when MN_RL =>
1673
        if clk_mstate_i = MSTATE3 then
1674
          alu_op_o             <= ALU_RL;
1675
          alu_read_alu_o       <= true;
1676
          alu_write_accu_o     <= true;
1677
 
1678
          if opc_opcode_s(4) = '1' then
1679
            psw_special_data_o <= alu_carry_i;
1680
            psw_write_carry_o  <= true;
1681
            alu_use_carry_o    <= true;
1682
          end if;
1683
        end if;
1684
 
1685
      -- Mnemonic RR ----------------------------------------------------------
1686
      when MN_RR =>
1687
        if clk_mstate_i = MSTATE3 then
1688
          alu_op_o             <= ALU_RR;
1689
          alu_read_alu_o       <= true;
1690
          alu_write_accu_o     <= true;
1691
 
1692
          if opc_opcode_s(4) = '0' then
1693
            psw_special_data_o <= alu_carry_i;
1694
            psw_write_carry_o  <= true;
1695
            alu_use_carry_o    <= true;
1696
          end if;
1697
        end if;
1698
 
1699
      -- Mnemonic SEL_MB ------------------------------------------------------
1700
      when MN_SEL_MB =>
1701
        if clk_mstate_i = MSTATE3 then
1702
          if opc_opcode_s(4) = '1' then
1703
            set_mb_s   <= true;
1704
          else
1705
            clear_mb_s <= true;
1706
          end if;
1707
        end if;
1708
 
1709
      -- Mnemonic SEL_RB ------------------------------------------------------
1710
      when MN_SEL_RB =>
1711
        if clk_mstate_i = MSTATE3 then
1712
          psw_special_data_o <= opc_opcode_s(4);
1713
          psw_write_bs_o     <= true;
1714
        end if;
1715
 
1716
      -- Mnemonic STOP_TCNT ---------------------------------------------------
1717
      when MN_STOP_TCNT =>
1718
        if clk_mstate_i = MSTATE3 then
1719
          tim_stop_tcnt_o <= true;
1720
        end if;
1721
 
1722
      -- Mnemonic STRT --------------------------------------------------------
1723
      when MN_STRT =>
1724
        if clk_mstate_i = MSTATE3 then
1725
          if opc_opcode_s(4) = '1' then
1726
            tim_start_t_o   <= true;
1727
          else
1728
            tim_start_cnt_o <= true;
1729
          end if;
1730
        end if;
1731
 
1732
      -- Mnemonic SWAP --------------------------------------------------------
1733
      when MN_SWAP =>
1734
        alu_op_o           <= ALU_SWAP;
1735
 
1736
        if clk_mstate_i = MSTATE3 then
1737
          alu_read_alu_o   <= true;
1738
          alu_write_accu_o <= true;
1739
        end if;
1740
 
1741
      -- Mnemonic XCH ---------------------------------------------------------
1742
      when MN_XCH =>
1743
        case clk_mstate_i is
1744
          -- read RAM once for indirect address mode
1745
          when MSTATE3 =>
1746 92 arniml
            if not enable_quartus_bugfix_c or
1747
               opc_opcode_s(3) = '0' then
1748
              address_indirect_3_f;
1749
            end if;
1750 4 arniml
 
1751 38 arniml
          -- store data from RAM in Accumulator and Temp Reg
1752 4 arniml
          -- Accumulator is already shadowed!
1753
          when MSTATE4 =>
1754 38 arniml
            dm_read_dmem_o       <= true;
1755
            alu_write_accu_o     <= true;
1756
            alu_write_temp_reg_o <= true;
1757
            if opc_opcode_s(4) = '1' then
1758
              -- XCHD
1759
              -- only write lower nibble of Accumulator
1760
              alu_accu_low_o     <= true;
1761
            end if;
1762 4 arniml
 
1763
          -- store data from shadow (previous) Accumulator to dmem
1764
          when MSTATE5 =>
1765 38 arniml
            dm_write_dmem_s      <= true;
1766
            alu_read_alu_o       <= true;
1767
            if opc_opcode_s(4) = '1' then
1768
              -- XCHD
1769
              -- concatenate shadow Accumulator and Temp Reg
1770
              alu_op_o           <= ALU_CONCAT;
1771
            end if;
1772 4 arniml
 
1773
          when others =>
1774
            null;
1775
 
1776
        end case;
1777
 
1778
      -- Mnemonic XRL ---------------------------------------------------------
1779
      when MN_XRL =>
1780
        case clk_mstate_i is
1781
          -- read RAM once for indirect address mode
1782
          when MSTATE3 =>
1783 92 arniml
            if not enable_quartus_bugfix_c or
1784
               opc_opcode_s(3) = '0' then
1785
              address_indirect_3_f;
1786
            end if;
1787 4 arniml
 
1788
          -- store data from RAM to Temp Reg
1789
          when MSTATE4 =>
1790
            and_or_xor_add_4_f;
1791
 
1792
          -- perform XOR and store in Accumulator
1793
          when MSTATE5 =>
1794
            and_or_xor_add_5_f(alu_op => ALU_XOR);
1795
 
1796
          when others =>
1797
            null;
1798
 
1799
        end case;
1800
 
1801
      -- Mnemonic XRL_A_DATA --------------------------------------------------
1802
      when MN_XRL_A_DATA =>
1803
        assert_psen_s              <= true;
1804
 
1805
        if clk_second_cycle_i then
1806
          case clk_mstate_i is
1807
            -- write Temp Reg when contents of Program Memory is on bus
1808
            when MSTATE1 =>
1809
              alu_write_temp_reg_o <= true;
1810
 
1811
            -- perform XOR and store in Accumulator
1812
            when MSTATE3 =>
1813
              and_or_xor_add_5_f(alu_op => ALU_XOR);
1814
 
1815
            when others =>
1816
              null;
1817
 
1818
          end case;
1819
 
1820
        end if;
1821
 
1822
      -- Unimplemented mnemonic -----------------------------------------------
1823
      when others =>
1824
        -- this will behave like a NOP
1825
 
1826
        -- pragma translate_off
1827
        assert false
1828
          report "Mnemonic not yet implemented."
1829
          severity warning;
1830
        -- pragma translate_on
1831
 
1832
    end case;
1833
 
1834
  end process decode;
1835
  --
1836
  -----------------------------------------------------------------------------
1837
 
1838
 
1839
  -----------------------------------------------------------------------------
1840
  -- Process regs
1841
  --
1842
  -- Purpose:
1843
  --   Implements the various registes.
1844
  --
1845
  regs: process (res_i, clk_i)
1846
  begin
1847
    if res_i = res_active_c then
1848
      branch_taken_q <= false;
1849
      f1_q           <= '0';
1850
      mb_q           <= '0';
1851
      t0_dir_q       <= '0';
1852 38 arniml
      -- pragma translate_off
1853 64 arniml
      istrobe_res_q  <= '1';
1854
      istrobe_q      <= '0';
1855 60 arniml
      injected_int_q <= '0';
1856 38 arniml
      -- pragma translate_on
1857 4 arniml
 
1858
    elsif clk_i'event and clk_i = clk_active_c then
1859
      if en_clk_i then
1860
 
1861
        -- branch taken flag
1862
        if branch_taken_s then
1863
          branch_taken_q <= true;
1864
        elsif clk_mstate_i = MSTATE5 then
1865
          -- release flag when new instruction starts
1866
          branch_taken_q <= false;
1867
        end if;
1868
 
1869
        -- Flag 1
1870
        if clear_f1_s then
1871
          f1_q         <= '0';
1872
        elsif cpl_f1_s then
1873
          f1_q         <= not f1_q;
1874
        end if;
1875
 
1876
        -- Memory Bank select
1877
        if clear_mb_s then
1878
          mb_q         <= '0';
1879
        elsif set_mb_s then
1880
          mb_q         <= '1';
1881
        end if;
1882
 
1883
        -- T0 direction selection
1884
        if ent0_clk_s then
1885
          t0_dir_q     <= '1';
1886
        end if;
1887
 
1888 60 arniml
        -- pragma translate_off
1889
        -- Marker for injected instruction ------------------------------------
1890
        if opc_inj_int_s then
1891
          injected_int_q <= '1';
1892
        elsif clk_mstate_i = MSTATE5 and last_cycle_s then
1893
          injected_int_q <= '0';
1894
        end if;
1895 64 arniml
 
1896
        -- Remove istrobe after reset suppression -----------------------------
1897
        if clk_mstate_i = MSTATE5 and last_cycle_s then
1898
          istrobe_res_q  <= '0';
1899
        end if;
1900 60 arniml
        -- pragma translate_on
1901
 
1902 38 arniml
      end if;
1903
 
1904 64 arniml
      -- pragma translate_off
1905
      -- Instruction Strobe ---------------------------------------------------
1906
      if clk_mstate_i = MSTATE5 and last_cycle_s and
1907
         injected_int_q = '0' then
1908
        if istrobe_res_q = '0' then
1909
          istrobe_q <= '1';
1910
        end if;
1911
      else
1912
        istrobe_q   <= '0';
1913
      end if;
1914
      -- pragma translate_on
1915
 
1916 4 arniml
    end if;
1917
 
1918
  end process regs;
1919
  --
1920
  -----------------------------------------------------------------------------
1921
 
1922 53 arniml
  -- pragma translate_off
1923
  -- assign to global signal for testbench
1924 64 arniml
  tb_istrobe_s <= istrobe_q;
1925 53 arniml
  -- pragma translate_on
1926 4 arniml
 
1927 53 arniml
 
1928 4 arniml
  -----------------------------------------------------------------------------
1929
  -- Output Mapping.
1930
  -----------------------------------------------------------------------------
1931
  clk_multi_cycle_o    <= opc_multi_cycle_s;
1932
  cnd_f1_o             <= f1_q;
1933
  cnd_tf_o             <= tf_s;
1934
  data_o               <=   data_s
1935
                          when read_dec_s else
1936
                            (others => bus_idle_level_c);
1937
  dm_write_dmem_o      <= dm_write_dmem_s      and en_clk_i;
1938
  pm_inc_pc_o          <= pm_inc_pc_s          or add_inc_pc_s;
1939
  pm_write_pmem_addr_o <= pm_write_pmem_addr_s or add_write_pmem_addr_s;
1940
  t0_dir_o             <= t0_dir_q;
1941
  bus_read_bus_o       <= bus_read_bus_s       or add_read_bus_s;
1942
 
1943
end rtl;
1944
 
1945
 
1946
-------------------------------------------------------------------------------
1947
-- File History:
1948
--
1949
-- $Log: not supported by cvs2svn $
1950 134 arniml
-- Revision 1.14  2004/06/30 21:18:28  arniml
1951
-- Fix bug report:
1952
-- "Program Memory bank can be switched during interrupt"
1953
-- int module emits int_in_progress signal that is used inside the decoder
1954
-- to hold mb low for JMP and CALL during interrupts
1955
--
1956 120 arniml
-- Revision 1.13  2004/05/20 21:51:40  arniml
1957
-- clean-up use of ea_i
1958
--
1959 106 arniml
-- Revision 1.12  2004/05/17 14:40:09  arniml
1960
-- assert p2_read_p2_o when expander port is read
1961
--
1962 101 arniml
-- Revision 1.11  2004/05/16 15:33:39  arniml
1963
-- work around bug in Quartus II 4.0
1964
--
1965 92 arniml
-- Revision 1.10  2004/04/25 16:22:03  arniml
1966
-- adjust external timing of BUS
1967
--
1968 78 arniml
-- Revision 1.9  2004/04/24 11:22:55  arniml
1969
-- removed superfluous signal from sensitivity list
1970
--
1971 72 arniml
-- Revision 1.8  2004/04/18 18:57:43  arniml
1972
-- + enhance instruction strobe generation
1973
-- + rework address output under EA=1 conditions
1974
--
1975 64 arniml
-- Revision 1.7  2004/04/15 22:06:05  arniml
1976
-- + add marker for injected calls
1977
-- + suppress intstruction strobes for injected calls
1978
--
1979 60 arniml
-- Revision 1.6  2004/04/14 20:53:33  arniml
1980
-- make istrobe visible through testbench package
1981
--
1982 53 arniml
-- Revision 1.5  2004/04/07 22:09:03  arniml
1983
-- remove unused signals
1984
--
1985 45 arniml
-- Revision 1.4  2004/04/04 14:18:53  arniml
1986
-- add measures to implement XCHD
1987
--
1988 38 arniml
-- Revision 1.3  2004/03/28 21:15:48  arniml
1989
-- implemented mnemonic DA
1990
--
1991 27 arniml
-- Revision 1.2  2004/03/28 13:06:32  arniml
1992
-- implement mnemonics:
1993
--    + MOVD_A_PP
1994
--    + OUTD_PP_A -> ANLD PP, A; MOVD PP, A; ORLD PP, A
1995
--
1996 21 arniml
-- Revision 1.1  2004/03/23 21:31:52  arniml
1997
-- initial check-in
1998 27 arniml
--
1999 4 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.