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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_5_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 143 arniml
-- $Id: decoder.vhd,v 1.16 2004-10-25 19:39:24 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 143 arniml
        clk_assert_rd_o  <= true;
990
 
991 4 arniml
        -- read BUS and store in Accumulator
992
        if clk_second_cycle_i and clk_mstate_i = MSTATE2 then
993
          alu_write_accu_o <= true;
994
 
995
          add_read_bus_s   <= true;
996
        end if;
997
 
998
      -- Mnemonic INC ---------------------------------------------------------
999
      when MN_INC =>
1000
        case clk_mstate_i is
1001
          -- read RAM once for indirect address mode
1002
          when MSTATE3 =>
1003 92 arniml
            if not enable_quartus_bugfix_c or
1004
               opc_opcode_s(3) = '0' then
1005
              address_indirect_3_f;
1006
            end if;
1007 4 arniml
 
1008
          when MSTATE4 =>
1009
            -- INC Rr; INC @ Rr: store data from RAM to shadow Accumulator
1010
            if opc_opcode_s(3 downto 2) /= "01" then
1011
              dm_read_dmem_o         <= true;
1012
              alu_write_shadow_o     <= true;
1013
            end if;
1014
 
1015
          when MSTATE5 =>
1016
            alu_op_o                 <= ALU_INC;
1017
            alu_read_alu_o           <= true;
1018
 
1019
            if opc_opcode_s(3 downto 2) = "01" then
1020
              -- write INC output of ALU to Accumulator
1021
              alu_write_accu_o       <= true;
1022
            else
1023
              -- store INC of shadow Accumulator back to dmem
1024
              dm_write_dmem_s        <= true;
1025
            end if;
1026
 
1027
          when others =>
1028
            null;
1029
 
1030
        end case;
1031
 
1032
      -- Mnemonic JBB ---------------------------------------------------------
1033
      when MN_JBB =>
1034
        assert_psen_s          <= true;
1035
        cnd_branch_cond_o      <= COND_ON_BIT;
1036
 
1037
        if not clk_second_cycle_i then
1038
          -- read Accumulator and start branch calculation
1039
          if clk_mstate_i = MSTATE3 then
1040
            alu_read_alu_o     <= true;
1041
            cnd_compute_take_o <= true;
1042
            -- cnd_comp_value_o is ok by default assignment
1043
          end if;
1044
 
1045
        else
1046
          -- store address in Program Counter low byte if branch has to
1047
          -- be taken
1048 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1049
            cond_jump_c2_m1_f;
1050
          end if;
1051 4 arniml
 
1052
        end if;
1053
 
1054
      -- Mnemonic JC ----------------------------------------------------------
1055
      when MN_JC =>
1056
        assert_psen_s           <= true;
1057
        cnd_branch_cond_o       <= COND_C;
1058
 
1059
        if not clk_second_cycle_i then
1060
          -- start branch calculation
1061
          if clk_mstate_i = MSTATE3 then
1062
            cnd_compute_take_o  <= true;
1063
            cnd_comp_value_o(0) <= opc_opcode_s(4);
1064
          end if;
1065
 
1066
        else
1067
          -- store address in Program Counter low byte if branch has to
1068
          -- be taken
1069 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1070
            cond_jump_c2_m1_f;
1071
          end if;
1072 4 arniml
 
1073
        end if;
1074
 
1075
      -- Mnemonic JF ----------------------------------------------------------
1076
      when MN_JF =>
1077
        assert_psen_s           <= true;
1078
 
1079
        if not clk_second_cycle_i then
1080
          -- start branch calculation
1081
          if clk_mstate_i = MSTATE3 then
1082
            cnd_compute_take_o  <= true;
1083
            if opc_opcode_s(7) = '1' then
1084
              -- JF0
1085
              cnd_branch_cond_o <= COND_F0;
1086
            else
1087
              -- JF1
1088
              cnd_branch_cond_o <= COND_F1;
1089
            end if;
1090
 
1091
          end if;
1092
 
1093
        else
1094
          -- store address in Program Counter low byte if branch has to
1095
          -- be taken
1096 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1097
            cond_jump_c2_m1_f;
1098
          end if;
1099 4 arniml
 
1100
        end if;
1101
 
1102
 
1103
      -- Mnemonic JMP ---------------------------------------------------------
1104
      when MN_JMP =>
1105
        assert_psen_s        <= true;
1106
 
1107
        if clk_second_cycle_i then
1108
          case clk_mstate_i is
1109
            -- store address in Program Counter low byte
1110
            when MSTATE1 =>
1111
              pm_write_pcl_o <= true;
1112
              branch_taken_s <= true;
1113
 
1114
            -- store high part of target address in Program Counter
1115
            when MSTATE2 =>
1116 120 arniml
              data_s         <= "0000" & mb_v & opc_opcode_s(7 downto 5);
1117 4 arniml
              read_dec_s     <= true;
1118
              pm_write_pch_o <= true;
1119
 
1120
            when others =>
1121
              null;
1122
 
1123
          end case;
1124
 
1125
        end if;
1126
 
1127
      -- Mnemonic JMPP --------------------------------------------------------
1128
      when MN_JMPP =>
1129
        assert_psen_s    <= true;
1130
 
1131
        if not clk_second_cycle_i then
1132
          -- write Accumulator to Program Memory address
1133
          -- (skip page offset update from Program Counter)
1134
          if clk_mstate_i = MSTATE3 then
1135
            alu_read_alu_o <= true;
1136
            pm_addr_type_o <= PM_PAGE;
1137
          end if;
1138
 
1139
        else
1140
          if clk_mstate_i = MSTATE1 then
1141
            -- store address in Program Counter low byte
1142
            pm_write_pcl_o <= true;
1143
            branch_taken_s <= true;
1144
          end if;
1145
 
1146
        end if;
1147
 
1148
      -- Mnemonic JNI ---------------------------------------------------------
1149
      when MN_JNI =>
1150
        assert_psen_s          <= true;
1151
        cnd_branch_cond_o      <= COND_INT;
1152
 
1153
        if not clk_second_cycle_i then
1154
          -- start branch calculation
1155
          if clk_mstate_i = MSTATE3 then
1156
            cnd_compute_take_o <= true;
1157
          end if;
1158
 
1159
        else
1160
          -- store address in Program Counter low byte if branch has to
1161
          -- be taken
1162 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1163
            cond_jump_c2_m1_f;
1164
          end if;
1165 4 arniml
 
1166
        end if;
1167
 
1168
      -- Mnemonic JT ----------------------------------------------------------
1169
      when MN_JT =>
1170
        assert_psen_s           <= true;
1171
        if opc_opcode_s(6) = '0' then
1172
          cnd_branch_cond_o     <= COND_T0;
1173
        else
1174
          cnd_branch_cond_o     <= COND_T1;
1175
        end if;
1176
 
1177
        if not clk_second_cycle_i then
1178
          -- start branch calculation
1179
          if clk_mstate_i = MSTATE3 then
1180
            cnd_compute_take_o  <= true;
1181
            cnd_comp_value_o(0) <= opc_opcode_s(4);
1182
          end if;
1183
 
1184
        else
1185
          -- store address in Program Counter low byte if branch has to
1186
          -- be taken
1187 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1188
            cond_jump_c2_m1_f;
1189
          end if;
1190 4 arniml
 
1191
        end if;
1192
 
1193
      -- Mnemonic JTF ---------------------------------------------------------
1194
      when MN_JTF =>
1195
        assert_psen_s          <= true;
1196
        cnd_branch_cond_o      <= COND_TF;
1197
 
1198
        if not clk_second_cycle_i then
1199
          -- start branch calculation
1200
          if clk_mstate_i = MSTATE3 then
1201
            cnd_compute_take_o <= true;
1202
            jtf_executed_s     <= true;
1203
          end if;
1204
 
1205
        else
1206
          -- store address in Program Counter low byte if branch has to
1207
          -- be taken
1208 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1209
            cond_jump_c2_m1_f;
1210
          end if;
1211 4 arniml
 
1212
        end if;
1213
 
1214
      -- Mnemonic JZ ----------------------------------------------------------
1215
      when MN_JZ =>
1216
        assert_psen_s           <= true;
1217
        cnd_branch_cond_o       <= COND_Z;
1218
 
1219
        if not clk_second_cycle_i then
1220
          -- read Accumulator and start branch calculation
1221
          if clk_mstate_i = MSTATE3 then
1222
            alu_read_alu_o      <= true;
1223
            cnd_compute_take_o  <= true;
1224
            cnd_comp_value_o(0) <= opc_opcode_s(6);
1225
          end if;
1226
 
1227
        else
1228
          -- store address in Program Counter low byte if branch has to
1229
          -- be taken
1230 92 arniml
          if clk_mstate_i = MSTATE1 and cnd_take_branch_i then
1231
            cond_jump_c2_m1_f;
1232
          end if;
1233 4 arniml
 
1234
        end if;
1235
 
1236
      -- Mnemonic MOV_A_DATA --------------------------------------------------
1237
      when MN_MOV_A_DATA =>
1238
        assert_psen_s      <= true;
1239
 
1240
        -- Write Accumulator when contents of Program Memory is on bus
1241
        -- during machine state 1 of second cycle.
1242
        if clk_second_cycle_i and clk_mstate_i = MSTATE1 then
1243
          alu_write_accu_o <= true;
1244
        end if;
1245
 
1246
      -- Mnemonic MOV_A_RR ----------------------------------------------------
1247
      when MN_MOV_A_RR =>
1248
        case clk_mstate_i is
1249
          -- read RAM once for indirect address mode
1250
          when MSTATE3 =>
1251 92 arniml
            if not enable_quartus_bugfix_c or
1252
               opc_opcode_s(3) = '0' then
1253
              address_indirect_3_f;
1254
            end if;
1255 4 arniml
 
1256
          -- read data from RAM and store in Accumulator
1257
          when MSTATE4 =>
1258
            and_or_xor_add_4_f;
1259
            alu_write_accu_o <= true;
1260
 
1261
          when others =>
1262
            null;
1263
 
1264
        end case;
1265
 
1266
      -- Mnemonic MOV_A_PSW ---------------------------------------------------
1267
      when MN_MOV_A_PSW =>
1268
        if clk_mstate_i = MSTATE3 then
1269
          psw_read_psw_o   <= true;
1270
          psw_read_sp_o    <= true;
1271
          alu_write_accu_o <= true;
1272
        end if;
1273
 
1274
      -- Mnemoniv MOV_PSW_A ---------------------------------------------------
1275
      when MN_MOV_PSW_A =>
1276
        if clk_mstate_i = MSTATE3 then
1277
          alu_read_alu_o  <= true;
1278
          psw_write_psw_o <= true;
1279
          psw_write_sp_o  <= true;
1280
        end if;
1281
 
1282
      -- Mnemonic MOV_RR ------------------------------------------------------
1283
      when MN_MOV_RR =>
1284
        case clk_mstate_i is
1285
          -- read RAM once for indirect address mode
1286
          when MSTATE3 =>
1287 92 arniml
            if not enable_quartus_bugfix_c or
1288
               opc_opcode_s(3) = '0' then
1289
              address_indirect_3_f;
1290
            end if;
1291 4 arniml
 
1292
          -- write Accumulator to dmem
1293
          when MSTATE5 =>
1294
            alu_read_alu_o       <= true;
1295
            dm_write_dmem_s      <= true;
1296
 
1297
          when others =>
1298
            null;
1299
 
1300
        end case;
1301
 
1302
      -- Mnemonic MOV_RR_DATA -------------------------------------------------
1303
      when MN_MOV_RR_DATA =>
1304
        assert_psen_s     <= true;
1305
 
1306
        -- read RAM once for indirect address mode
1307
        if not clk_second_cycle_i and clk_mstate_i = MSTATE3 then
1308 92 arniml
          if not enable_quartus_bugfix_c or
1309
             opc_opcode_s(3) = '0' then
1310
            address_indirect_3_f;
1311
          end if;
1312 4 arniml
        end if;
1313
 
1314
        -- Write Data Memory when contents of Program Memory is on bus
1315
        -- during machine state 1 of second cycle.
1316
        if clk_second_cycle_i and clk_mstate_i = MSTATE1 then
1317
          dm_write_dmem_s <= true;
1318
        end if;
1319
 
1320
      -- Mnemonic MOV_T -------------------------------------------------------
1321
      when MN_MOV_T =>
1322
        if clk_mstate_i = MSTATE3 then
1323
          if opc_opcode_s(5) = '1' then
1324
            alu_read_alu_o    <= true;  -- MOV T, A
1325
            tim_write_timer_o <= true;
1326
          else
1327
            tim_read_timer_o  <= true;  -- MOV A, T
1328
            alu_write_accu_o  <= true;
1329
          end if;
1330
        end if;
1331
 
1332 21 arniml
      -- Mnemonic OUTD_PP_A ---------------------------------------------------
1333
      when MN_OUTD_PP_A =>
1334
        clk_assert_prog_o     <= true;
1335
 
1336
        if not clk_second_cycle_i then
1337
          case clk_mstate_i is
1338
            -- propagate expander port number to Port 2
1339
            when MSTATE3 =>
1340
 
1341
              data_s(7 downto 4)     <= (others => '0');
1342
              data_s(1 downto 0)     <= opc_opcode_s(1 downto 0);
1343
              -- decide which 8243 command to use
1344
              case opc_opcode_s(7 downto 4) is
1345
                when "1001" =>
1346
                  data_s(3 downto 2) <= "11";  -- ANLD command
1347
                when "1000" =>
1348
                  data_s(3 downto 2) <= "10";  -- ORLD command
1349
                when "0011" =>
1350
                  data_s(3 downto 2) <= "01";  -- MOVD command
1351
                when others =>
1352
                  null;
1353
              end case;
1354
 
1355
              read_dec_s      <= true;
1356
              p2_write_exp_o  <= true;
1357
 
1358
            -- output expander port number on Port 2 while active edge of PROG
1359
            -- write Accumulator to expander port
1360
            when MSTATE4 =>
1361
              p2_output_exp_o <= true;
1362
 
1363
              alu_read_alu_o  <= true;
1364
              p2_write_exp_o  <= true;
1365
 
1366
            when MSTATE5 =>
1367
              p2_output_exp_o <= true;
1368
 
1369
            when others =>
1370
              null;
1371
 
1372
          end case;
1373
 
1374
        else
1375
          -- hold expander port until inactive edge of PROG 
1376
          if clk_mstate_i = MSTATE1 or clk_mstate_i = MSTATE2 then
1377
            p2_output_exp_o   <= true;
1378
          end if;
1379
 
1380
        end if;
1381
 
1382
      -- Mnemonic MOVD_A_PP ---------------------------------------------------
1383
      when MN_MOVD_A_PP =>
1384
        clk_assert_prog_o            <= true;
1385
 
1386
        if not clk_second_cycle_i then
1387
          case clk_mstate_i is
1388
            -- propagate expander port number to Port 2
1389
            when MSTATE3 =>
1390
              data_s                 <= "0000" &
1391
                                        "00"   &  -- 8243 command: read
1392
                                        opc_opcode_s(1 downto 0);
1393
              read_dec_s             <= true;
1394
              p2_write_exp_o         <= true;
1395
 
1396
            -- output expander port number on Port 2 while active edge of PROG
1397
            -- write 1's to expander port to set lower nibble of Port 2 to input
1398
            when MSTATE4 =>
1399
              p2_output_exp_o        <= true;
1400
 
1401
              data_s(nibble_t'range) <= (others => '1');
1402
              read_dec_s             <= true;
1403
              p2_write_exp_o         <= true;
1404
 
1405
            when MSTATE5 =>
1406
              p2_output_exp_o        <= true;
1407
 
1408
            when others =>
1409
              null;
1410
 
1411
          end case;
1412
 
1413
        else
1414
          case clk_mstate_i is
1415
            -- hold expander port until inactive edge of PROG
1416
            when MSTATE1 =>
1417
              p2_output_exp_o  <= true;
1418
 
1419
            -- hold expander port until inactive edge of PROG
1420
            -- write Accumulator with nibble of expander port
1421
            when MSTATE2 =>
1422 101 arniml
              p2_read_p2_o     <= true;
1423 21 arniml
              p2_output_exp_o  <= true;
1424
              p2_read_exp_o    <= true;
1425
              alu_write_accu_o <= true;
1426
 
1427
            when others =>
1428
              null;
1429
 
1430
          end case;
1431
 
1432
        end if;
1433
 
1434 4 arniml
      -- Mnemonic MOVP --------------------------------------------------------
1435
      when MN_MOVP =>
1436
        assert_psen_s        <= true;
1437
 
1438
        if not clk_second_cycle_i then
1439
          -- write Accumulator to Program Memory address
1440
          -- (skip page offset update from Program Counter)
1441
          if clk_mstate_i = MSTATE3 then
1442
            alu_read_alu_o   <= true;
1443
            if opc_opcode_s(6) = '0' then
1444
              pm_addr_type_o <= PM_PAGE;
1445
            else
1446
              pm_addr_type_o <= PM_PAGE3;
1447
            end if;
1448
          end if;
1449
 
1450
        else
1451
          if clk_mstate_i = MSTATE1 then
1452
            -- store data from Program Memory in Accumulator
1453
            alu_write_accu_o <= true;
1454
            -- trick & treat to prevent additional PC increment
1455
            -- our branch target is the previously incremented PC!
1456
            branch_taken_s   <= true;
1457
          end if;
1458
 
1459
        end if;
1460
 
1461
      -- Mnemonic MOVX --------------------------------------------------------
1462
      when MN_MOVX =>
1463
        bus_bidir_bus_o        <= true;
1464
 
1465
        if opc_opcode_s(4) = '0' then
1466
          clk_assert_rd_o      <= true;
1467
        else
1468
          clk_assert_wr_o      <= true;
1469
        end if;
1470
 
1471
        if not clk_second_cycle_i then
1472 78 arniml
          case clk_mstate_i is
1473
            -- read dmem and put contents on BUS as external address
1474
            when MSTATE3 =>
1475
              dm_read_dmem_o     <= true;
1476
              bus_write_bus_o    <= true;
1477 4 arniml
 
1478 78 arniml
            -- store contents of Accumulator to BUS
1479
            when MSTATE5 =>
1480
              if opc_opcode_s(4) = '1' then
1481
                alu_read_alu_o   <= true;
1482
                bus_write_bus_o  <= true;
1483
              end if;
1484
 
1485
            when others =>
1486
              null;
1487
          end case;
1488
 
1489 4 arniml
        else
1490
          if clk_mstate_i = MSTATE1 then
1491
            if opc_opcode_s(4) = '0' then
1492
              -- store contents of BUS in Accumulator
1493
              add_read_bus_s   <= true;
1494
              alu_write_accu_o <= true;
1495
            else
1496
              -- store contents of Accumulator to BUS
1497
              alu_read_alu_o   <= true;
1498
              bus_write_bus_o  <= true;
1499
            end if;
1500
          end if;
1501
 
1502
        end if;
1503
 
1504
      -- Mnemonic NOP ---------------------------------------------------------
1505
      when MN_NOP =>
1506
        -- nothing to do
1507
 
1508
      -- Mnemonic ORL ---------------------------------------------------------
1509
      when MN_ORL =>
1510
        case clk_mstate_i is
1511
          -- read RAM once for indirect address mode
1512
          when MSTATE3 =>
1513 92 arniml
            if not enable_quartus_bugfix_c or
1514
               opc_opcode_s(3) = '0' then
1515
              address_indirect_3_f;
1516
            end if;
1517 4 arniml
 
1518
          -- store data from RAM to Temp Reg
1519
          when MSTATE4 =>
1520
            and_or_xor_add_4_f;
1521
 
1522
          -- perform OR and store in Accumulator
1523
          when MSTATE5 =>
1524
            and_or_xor_add_5_f(alu_op => ALU_OR);
1525
 
1526
          when others =>
1527
            null;
1528
 
1529
        end case;
1530
 
1531
      -- Mnemonic ORL_A_DATA --------------------------------------------------
1532
      when MN_ORL_A_DATA =>
1533
        assert_psen_s              <= true;
1534
 
1535
        if clk_second_cycle_i then
1536
          case clk_mstate_i is
1537
            -- write Temp Reg when contents of Program Memory is on bus
1538
            when MSTATE1 =>
1539
              alu_write_temp_reg_o <= true;
1540
 
1541
            -- perform OR and store in Accumulator
1542
            when MSTATE3 =>
1543
              and_or_xor_add_5_f(alu_op => ALU_OR);
1544
 
1545
            when others =>
1546
              null;
1547
 
1548
          end case;
1549
 
1550
        end if;
1551
 
1552
      -- Mnemonic ORL_EXT -----------------------------------------------------
1553
      when MN_ORL_EXT =>
1554
        assert_psen_s            <= true;
1555
 
1556
        if not clk_second_cycle_i then
1557
          -- read port to Temp Reg
1558
          if clk_mstate_i = MSTATE5 then
1559
            if opc_opcode_s(1 downto 0) = "00" then
1560
              add_read_bus_s     <= true;
1561
            elsif opc_opcode_s(1) = '0' then
1562
              p1_read_p1_o       <= true;
1563
              p1_read_reg_o      <= true;
1564
            else
1565
              p2_read_p2_o       <= true;
1566
              p2_read_reg_o      <= true;
1567
            end if;
1568
 
1569
            alu_write_temp_reg_o <= true;
1570
          end if;
1571
 
1572
        else
1573
          case clk_mstate_i is
1574
            -- write shadow Accumulator when contents of Program Memory is
1575
            -- on bus
1576
            when MSTATE1 =>
1577
              alu_write_shadow_o <= true;
1578
 
1579
            -- loop shadow Accumulator through ALU to prevent update from
1580
            -- real Accumulator
1581
            when MSTATE2 =>
1582
              alu_read_alu_o     <= true;
1583
              alu_write_shadow_o <= true;
1584
 
1585
            -- write result of OR operation back to port
1586
            when MSTATE3 =>
1587
              alu_op_o           <= ALU_OR;
1588
              alu_read_alu_o     <= true;
1589
 
1590
              if opc_opcode_s(1 downto 0) = "00" then
1591
                bus_write_bus_o  <= true;
1592
              elsif opc_opcode_s(1) = '0' then
1593
                p1_write_p1_o    <= true;
1594
              else
1595
                p2_write_p2_o    <= true;
1596
              end if;
1597
 
1598
            when others =>
1599
              null;
1600
 
1601
          end case;
1602
 
1603
        end if;
1604
 
1605
      -- Mnemonic OUTL_EXT ----------------------------------------------------
1606
      when MN_OUTL_EXT =>
1607 143 arniml
        if opc_opcode_s(4) = '0' then
1608
          clk_assert_wr_o <= true;
1609
        end if;
1610
 
1611 4 arniml
        -- read Accumulator and store in Port/BUS output register
1612 143 arniml
        if not clk_second_cycle_i and clk_mstate_i = MSTATE4 then
1613 4 arniml
          alu_read_alu_o  <= true;
1614
 
1615
          if opc_opcode_s(4) = '1' then
1616
            if opc_opcode_s(1) = '0' then
1617
              p1_write_p1_o <= true;
1618
            else
1619
              p2_write_p2_o <= true;
1620
            end if;
1621
 
1622
          else
1623
            bus_write_bus_o <= true;
1624
 
1625
          end if;
1626
 
1627
        end if;
1628
 
1629
      -- Mnemonic RET ---------------------------------------------------------
1630
      when MN_RET =>
1631
        if not clk_second_cycle_i then
1632
          case clk_mstate_i is
1633
            -- decrement Stack Pointer
1634
            when MSTATE3 =>
1635
              psw_dec_stackp_o     <= true;
1636
 
1637
            -- read Stack Pointer and address Data Memory for low byte
1638
            when MSTATE4 =>
1639
              psw_read_sp_o        <= true;
1640
              dm_write_dmem_addr_o <= true;
1641
              dm_addr_type_o       <= DM_STACK;
1642
 
1643
            -- read Data Memory and store to Program Counter low
1644
            -- prepare address to Data memory for high byte
1645
            when MSTATE5 =>
1646
              dm_read_dmem_o       <= true;
1647
              pm_write_pcl_o       <= true;
1648
              dm_write_dmem_addr_o <= true;
1649
              dm_addr_type_o       <= DM_STACK_HIGH;
1650
 
1651
            when others =>
1652
              null;
1653
 
1654
          end case;
1655
 
1656
        else
1657
          case clk_mstate_i is
1658
            -- read Data Memory and store to Program Counter high and PSW
1659
            when MSTATE1 =>
1660
              dm_read_dmem_o         <= true;
1661
              pm_write_pch_o         <= true;
1662
              if opc_opcode_s(4) = '1' then
1663
                psw_write_psw_o      <= true;
1664
                retr_executed_s      <= true;
1665
              end if;
1666
 
1667
            when MSTATE2 =>
1668
              add_write_pmem_addr_s  <= true;
1669
 
1670
            when others =>
1671
              null;
1672
 
1673
          end case;
1674
 
1675
        end if;
1676
 
1677
      -- Mnemonic RL ----------------------------------------------------------
1678
      when MN_RL =>
1679
        if clk_mstate_i = MSTATE3 then
1680
          alu_op_o             <= ALU_RL;
1681
          alu_read_alu_o       <= true;
1682
          alu_write_accu_o     <= true;
1683
 
1684
          if opc_opcode_s(4) = '1' then
1685
            psw_special_data_o <= alu_carry_i;
1686
            psw_write_carry_o  <= true;
1687
            alu_use_carry_o    <= true;
1688
          end if;
1689
        end if;
1690
 
1691
      -- Mnemonic RR ----------------------------------------------------------
1692
      when MN_RR =>
1693
        if clk_mstate_i = MSTATE3 then
1694
          alu_op_o             <= ALU_RR;
1695
          alu_read_alu_o       <= true;
1696
          alu_write_accu_o     <= true;
1697
 
1698
          if opc_opcode_s(4) = '0' then
1699
            psw_special_data_o <= alu_carry_i;
1700
            psw_write_carry_o  <= true;
1701
            alu_use_carry_o    <= true;
1702
          end if;
1703
        end if;
1704
 
1705
      -- Mnemonic SEL_MB ------------------------------------------------------
1706
      when MN_SEL_MB =>
1707
        if clk_mstate_i = MSTATE3 then
1708
          if opc_opcode_s(4) = '1' then
1709
            set_mb_s   <= true;
1710
          else
1711
            clear_mb_s <= true;
1712
          end if;
1713
        end if;
1714
 
1715
      -- Mnemonic SEL_RB ------------------------------------------------------
1716
      when MN_SEL_RB =>
1717
        if clk_mstate_i = MSTATE3 then
1718
          psw_special_data_o <= opc_opcode_s(4);
1719
          psw_write_bs_o     <= true;
1720
        end if;
1721
 
1722
      -- Mnemonic STOP_TCNT ---------------------------------------------------
1723
      when MN_STOP_TCNT =>
1724
        if clk_mstate_i = MSTATE3 then
1725
          tim_stop_tcnt_o <= true;
1726
        end if;
1727
 
1728
      -- Mnemonic STRT --------------------------------------------------------
1729
      when MN_STRT =>
1730
        if clk_mstate_i = MSTATE3 then
1731
          if opc_opcode_s(4) = '1' then
1732
            tim_start_t_o   <= true;
1733
          else
1734
            tim_start_cnt_o <= true;
1735
          end if;
1736
        end if;
1737
 
1738
      -- Mnemonic SWAP --------------------------------------------------------
1739
      when MN_SWAP =>
1740
        alu_op_o           <= ALU_SWAP;
1741
 
1742
        if clk_mstate_i = MSTATE3 then
1743
          alu_read_alu_o   <= true;
1744
          alu_write_accu_o <= true;
1745
        end if;
1746
 
1747
      -- Mnemonic XCH ---------------------------------------------------------
1748
      when MN_XCH =>
1749
        case clk_mstate_i is
1750
          -- read RAM once for indirect address mode
1751
          when MSTATE3 =>
1752 92 arniml
            if not enable_quartus_bugfix_c or
1753
               opc_opcode_s(3) = '0' then
1754
              address_indirect_3_f;
1755
            end if;
1756 4 arniml
 
1757 38 arniml
          -- store data from RAM in Accumulator and Temp Reg
1758 4 arniml
          -- Accumulator is already shadowed!
1759
          when MSTATE4 =>
1760 38 arniml
            dm_read_dmem_o       <= true;
1761
            alu_write_accu_o     <= true;
1762
            alu_write_temp_reg_o <= true;
1763
            if opc_opcode_s(4) = '1' then
1764
              -- XCHD
1765
              -- only write lower nibble of Accumulator
1766
              alu_accu_low_o     <= true;
1767
            end if;
1768 4 arniml
 
1769
          -- store data from shadow (previous) Accumulator to dmem
1770
          when MSTATE5 =>
1771 38 arniml
            dm_write_dmem_s      <= true;
1772
            alu_read_alu_o       <= true;
1773
            if opc_opcode_s(4) = '1' then
1774
              -- XCHD
1775
              -- concatenate shadow Accumulator and Temp Reg
1776
              alu_op_o           <= ALU_CONCAT;
1777
            end if;
1778 4 arniml
 
1779
          when others =>
1780
            null;
1781
 
1782
        end case;
1783
 
1784
      -- Mnemonic XRL ---------------------------------------------------------
1785
      when MN_XRL =>
1786
        case clk_mstate_i is
1787
          -- read RAM once for indirect address mode
1788
          when MSTATE3 =>
1789 92 arniml
            if not enable_quartus_bugfix_c or
1790
               opc_opcode_s(3) = '0' then
1791
              address_indirect_3_f;
1792
            end if;
1793 4 arniml
 
1794
          -- store data from RAM to Temp Reg
1795
          when MSTATE4 =>
1796
            and_or_xor_add_4_f;
1797
 
1798
          -- perform XOR and store in Accumulator
1799
          when MSTATE5 =>
1800
            and_or_xor_add_5_f(alu_op => ALU_XOR);
1801
 
1802
          when others =>
1803
            null;
1804
 
1805
        end case;
1806
 
1807
      -- Mnemonic XRL_A_DATA --------------------------------------------------
1808
      when MN_XRL_A_DATA =>
1809
        assert_psen_s              <= true;
1810
 
1811
        if clk_second_cycle_i then
1812
          case clk_mstate_i is
1813
            -- write Temp Reg when contents of Program Memory is on bus
1814
            when MSTATE1 =>
1815
              alu_write_temp_reg_o <= true;
1816
 
1817
            -- perform XOR and store in Accumulator
1818
            when MSTATE3 =>
1819
              and_or_xor_add_5_f(alu_op => ALU_XOR);
1820
 
1821
            when others =>
1822
              null;
1823
 
1824
          end case;
1825
 
1826
        end if;
1827
 
1828
      -- Unimplemented mnemonic -----------------------------------------------
1829
      when others =>
1830
        -- this will behave like a NOP
1831
 
1832
        -- pragma translate_off
1833
        assert false
1834
          report "Mnemonic not yet implemented."
1835
          severity warning;
1836
        -- pragma translate_on
1837
 
1838
    end case;
1839
 
1840
  end process decode;
1841
  --
1842
  -----------------------------------------------------------------------------
1843
 
1844
 
1845
  -----------------------------------------------------------------------------
1846
  -- Process regs
1847
  --
1848
  -- Purpose:
1849
  --   Implements the various registes.
1850
  --
1851
  regs: process (res_i, clk_i)
1852
  begin
1853
    if res_i = res_active_c then
1854
      branch_taken_q <= false;
1855
      f1_q           <= '0';
1856
      mb_q           <= '0';
1857
      t0_dir_q       <= '0';
1858 38 arniml
      -- pragma translate_off
1859 64 arniml
      istrobe_res_q  <= '1';
1860
      istrobe_q      <= '0';
1861 60 arniml
      injected_int_q <= '0';
1862 38 arniml
      -- pragma translate_on
1863 4 arniml
 
1864
    elsif clk_i'event and clk_i = clk_active_c then
1865
      if en_clk_i then
1866
 
1867
        -- branch taken flag
1868
        if branch_taken_s then
1869
          branch_taken_q <= true;
1870
        elsif clk_mstate_i = MSTATE5 then
1871
          -- release flag when new instruction starts
1872
          branch_taken_q <= false;
1873
        end if;
1874
 
1875
        -- Flag 1
1876
        if clear_f1_s then
1877
          f1_q         <= '0';
1878
        elsif cpl_f1_s then
1879
          f1_q         <= not f1_q;
1880
        end if;
1881
 
1882
        -- Memory Bank select
1883
        if clear_mb_s then
1884
          mb_q         <= '0';
1885
        elsif set_mb_s then
1886
          mb_q         <= '1';
1887
        end if;
1888
 
1889
        -- T0 direction selection
1890
        if ent0_clk_s then
1891
          t0_dir_q     <= '1';
1892
        end if;
1893
 
1894 60 arniml
        -- pragma translate_off
1895
        -- Marker for injected instruction ------------------------------------
1896
        if opc_inj_int_s then
1897
          injected_int_q <= '1';
1898
        elsif clk_mstate_i = MSTATE5 and last_cycle_s then
1899
          injected_int_q <= '0';
1900
        end if;
1901 64 arniml
 
1902
        -- Remove istrobe after reset suppression -----------------------------
1903
        if clk_mstate_i = MSTATE5 and last_cycle_s then
1904
          istrobe_res_q  <= '0';
1905
        end if;
1906 60 arniml
        -- pragma translate_on
1907
 
1908 38 arniml
      end if;
1909
 
1910 64 arniml
      -- pragma translate_off
1911
      -- Instruction Strobe ---------------------------------------------------
1912
      if clk_mstate_i = MSTATE5 and last_cycle_s and
1913
         injected_int_q = '0' then
1914
        if istrobe_res_q = '0' then
1915
          istrobe_q <= '1';
1916
        end if;
1917
      else
1918
        istrobe_q   <= '0';
1919
      end if;
1920
      -- pragma translate_on
1921
 
1922 4 arniml
    end if;
1923
 
1924
  end process regs;
1925
  --
1926
  -----------------------------------------------------------------------------
1927
 
1928 53 arniml
  -- pragma translate_off
1929
  -- assign to global signal for testbench
1930 64 arniml
  tb_istrobe_s <= istrobe_q;
1931 53 arniml
  -- pragma translate_on
1932 4 arniml
 
1933 53 arniml
 
1934 4 arniml
  -----------------------------------------------------------------------------
1935
  -- Output Mapping.
1936
  -----------------------------------------------------------------------------
1937
  clk_multi_cycle_o    <= opc_multi_cycle_s;
1938
  cnd_f1_o             <= f1_q;
1939
  cnd_tf_o             <= tf_s;
1940
  data_o               <=   data_s
1941
                          when read_dec_s else
1942
                            (others => bus_idle_level_c);
1943
  dm_write_dmem_o      <= dm_write_dmem_s      and en_clk_i;
1944
  pm_inc_pc_o          <= pm_inc_pc_s          or add_inc_pc_s;
1945
  pm_write_pmem_addr_o <= pm_write_pmem_addr_s or add_write_pmem_addr_s;
1946
  t0_dir_o             <= t0_dir_q;
1947
  bus_read_bus_o       <= bus_read_bus_s       or add_read_bus_s;
1948
 
1949
end rtl;
1950
 
1951
 
1952
-------------------------------------------------------------------------------
1953
-- File History:
1954
--
1955
-- $Log: not supported by cvs2svn $
1956 143 arniml
-- Revision 1.15  2004/09/12 00:35:44  arniml
1957
-- Fix bug report:
1958
-- "PSENn Timing"
1959
-- PSEN is now only asserted for the second cycle if explicitely
1960
-- requested by assert_psen_s.
1961
-- The previous implementation asserted PSEN together with RD or WR.
1962
--
1963 134 arniml
-- Revision 1.14  2004/06/30 21:18:28  arniml
1964
-- Fix bug report:
1965
-- "Program Memory bank can be switched during interrupt"
1966
-- int module emits int_in_progress signal that is used inside the decoder
1967
-- to hold mb low for JMP and CALL during interrupts
1968
--
1969 120 arniml
-- Revision 1.13  2004/05/20 21:51:40  arniml
1970
-- clean-up use of ea_i
1971
--
1972 106 arniml
-- Revision 1.12  2004/05/17 14:40:09  arniml
1973
-- assert p2_read_p2_o when expander port is read
1974
--
1975 101 arniml
-- Revision 1.11  2004/05/16 15:33:39  arniml
1976
-- work around bug in Quartus II 4.0
1977
--
1978 92 arniml
-- Revision 1.10  2004/04/25 16:22:03  arniml
1979
-- adjust external timing of BUS
1980
--
1981 78 arniml
-- Revision 1.9  2004/04/24 11:22:55  arniml
1982
-- removed superfluous signal from sensitivity list
1983
--
1984 72 arniml
-- Revision 1.8  2004/04/18 18:57:43  arniml
1985
-- + enhance instruction strobe generation
1986
-- + rework address output under EA=1 conditions
1987
--
1988 64 arniml
-- Revision 1.7  2004/04/15 22:06:05  arniml
1989
-- + add marker for injected calls
1990
-- + suppress intstruction strobes for injected calls
1991
--
1992 60 arniml
-- Revision 1.6  2004/04/14 20:53:33  arniml
1993
-- make istrobe visible through testbench package
1994
--
1995 53 arniml
-- Revision 1.5  2004/04/07 22:09:03  arniml
1996
-- remove unused signals
1997
--
1998 45 arniml
-- Revision 1.4  2004/04/04 14:18:53  arniml
1999
-- add measures to implement XCHD
2000
--
2001 38 arniml
-- Revision 1.3  2004/03/28 21:15:48  arniml
2002
-- implemented mnemonic DA
2003
--
2004 27 arniml
-- Revision 1.2  2004/03/28 13:06:32  arniml
2005
-- implement mnemonics:
2006
--    + MOVD_A_PP
2007
--    + OUTD_PP_A -> ANLD PP, A; MOVD PP, A; ORLD PP, A
2008
--
2009 21 arniml
-- Revision 1.1  2004/03/23 21:31:52  arniml
2010
-- initial check-in
2011 27 arniml
--
2012 4 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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