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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [rtl/] [w11a/] [pdp11_decode.vhd] - Diff between revs 2 and 8

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 8
Line 1... Line 1...
-- $Id: pdp11_decode.vhd 314 2010-07-09 17:38:41Z mueller $
-- $Id: pdp11_decode.vhd 330 2010-09-19 17:43:53Z mueller $
--
--
-- Copyright 2006-2008 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2006-2008 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
--
--
-- This program is free software; you may redistribute and/or modify it under
-- This program is free software; you may redistribute and/or modify it under
-- the terms of the GNU General Public License as published by the Free
-- the terms of the GNU General Public License as published by the Free
Line 19... Line 19...
-- Test bench:     tb/tb_pdp11_core (implicit)
-- Test bench:     tb/tb_pdp11_core (implicit)
-- Target Devices: generic
-- Target Devices: generic
-- Tool versions:  xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25
-- Tool versions:  xst 8.1, 8.2, 9.1, 9.2; ghdl 0.18-0.25
-- Revision History: 
-- Revision History: 
-- Date         Rev Version  Comment
-- Date         Rev Version  Comment
 
-- 2010-09-18   300   1.0.5  rename (adlm)box->(oalm)unit
-- 2008-11-30   174   1.0.4  BUGFIX: add updt_dstadsrc; set for MFP(I/D)
-- 2008-11-30   174   1.0.4  BUGFIX: add updt_dstadsrc; set for MFP(I/D)
-- 2008-05-03   143   1.0.3  get fork_srcr,fork_dstr,fork_dsta assign out of if
-- 2008-05-03   143   1.0.3  get fork_srcr,fork_dstr,fork_dsta assign out of if
-- 2008-04-27   139   1.0.2  BUGFIX: mtp now via do_fork_op; is_dsta logic mods
-- 2008-04-27   139   1.0.2  BUGFIX: mtp now via do_fork_op; is_dsta logic mods
-- 2007-06-14    56   1.0.1  Use slvtypes.all
-- 2007-06-14    56   1.0.1  Use slvtypes.all
-- 2007-05-12    26   1.0    Initial version 
-- 2007-05-12    26   1.0    Initial version 
Line 101... Line 102...
    nstat.op_mov := '0';
    nstat.op_mov := '0';
    nstat.trap_vec := "000";
    nstat.trap_vec := "000";
    nstat.force_srcsp := '0';
    nstat.force_srcsp := '0';
    nstat.updt_dstadsrc := '0';
    nstat.updt_dstadsrc := '0';
 
 
    nstat.dbox_srcmod := c_dbox_mod_pass;
    nstat.aunit_srcmod := c_aunit_mod_pass;
    nstat.dbox_dstmod := c_dbox_mod_pass;
    nstat.aunit_dstmod := c_aunit_mod_pass;
    nstat.dbox_cimod := c_dbox_mod_pass;
    nstat.aunit_cimod := c_aunit_mod_pass;
    nstat.dbox_cc1op := '0';
    nstat.aunit_cc1op := '0';
    nstat.dbox_ccmode := IREG(8 downto 6);   -- STATIC
    nstat.aunit_ccmode := IREG(8 downto 6);   -- STATIC
    nstat.lbox_func := (others=>'0');
    nstat.lunit_func := (others=>'0');
    nstat.mbox_func := (others=>'0');
    nstat.munit_func := (others=>'0');
    nstat.res_sel := c_dpath_res_abox;
    nstat.res_sel := c_dpath_res_ounit;
 
 
    nstat.fork_op := (others=>'0');
    nstat.fork_op := (others=>'0');
    nstat.fork_srcr := (others=>'0');
    nstat.fork_srcr := (others=>'0');
    nstat.fork_dstr := (others=>'0');
    nstat.fork_dstr := (others=>'0');
    nstat.fork_dsta := (others=>'0');
    nstat.fork_dsta := (others=>'0');
Line 229... Line 230...
          nstat.is_res := '0';
          nstat.is_res := '0';
          is_dstm := '1';
          is_dstm := '1';
          nstat.fork_opg := c_fork_opg_gen;
          nstat.fork_opg := c_fork_opg_gen;
          nstat.do_fork_opg := '1';
          nstat.do_fork_opg := '1';
          nstat.do_pref_dec := is_dstmode0notpc;
          nstat.do_pref_dec := is_dstmode0notpc;
          nstat.lbox_func := c_lbox_func_swap;
          nstat.lunit_func := c_lunit_func_swap;
          nstat.res_sel := c_dpath_res_lbox;
          nstat.res_sel := c_dpath_res_lunit;
        end if;
        end if;
 
 
      end if; -- OPBYTE='0' and OPEXT1="000"
      end if; -- OPBYTE='0' and OPEXT1="000"
 
 
      if OPEXT1(2)='0' and              -- BR class instructions
      if OPEXT1(2)='0' and              -- BR class instructions
Line 263... Line 264...
        nstat.do_fork_op := '1';
        nstat.do_fork_op := '1';
      end if;
      end if;
 
 
      if OPEXT1 = "101" then            -- CLR(B),...,TST(B)
      if OPEXT1 = "101" then            -- CLR(B),...,TST(B)
        nstat.is_res := '0';
        nstat.is_res := '0';
        nstat.res_sel := c_dpath_res_dbox;
        nstat.res_sel := c_dpath_res_aunit;
        if OPBYTE = '1' then
        if OPBYTE = '1' then
          nstat.is_bytop := '1';
          nstat.is_bytop := '1';
        end if;
        end if;
 
 
        nstat.dbox_cc1op := '1';
        nstat.aunit_cc1op := '1';
 
 
        case OPEXT2 is
        case OPEXT2 is
          when "000" =>                 -- CLR:    0 +    0 + 0   (0)
          when "000" =>                 -- CLR:    0 +    0 + 0   (0)
            is_dstw := '1';
            is_dstw := '1';
            nstat.dbox_srcmod := c_dbox_mod_zero;
            nstat.aunit_srcmod := c_aunit_mod_zero;
            nstat.dbox_dstmod := c_dbox_mod_zero;
            nstat.aunit_dstmod := c_aunit_mod_zero;
            nstat.dbox_cimod  := c_dbox_mod_zero;
            nstat.aunit_cimod  := c_aunit_mod_zero;
          when "001" =>                 -- COM:    0 + ~DST + 0   (~dst)
          when "001" =>                 -- COM:    0 + ~DST + 0   (~dst)
            is_dstm := '1';
            is_dstm := '1';
            nstat.dbox_srcmod := c_dbox_mod_zero;
            nstat.aunit_srcmod := c_aunit_mod_zero;
            nstat.dbox_dstmod := c_dbox_mod_inv;
            nstat.aunit_dstmod := c_aunit_mod_inv;
            nstat.dbox_cimod  := c_dbox_mod_zero;
            nstat.aunit_cimod  := c_aunit_mod_zero;
          when "010" =>                 -- INC:    0 +  DST + 1   (dst+1)
          when "010" =>                 -- INC:    0 +  DST + 1   (dst+1)
            is_dstm := '1';
            is_dstm := '1';
            nstat.dbox_srcmod := c_dbox_mod_zero;
            nstat.aunit_srcmod := c_aunit_mod_zero;
            nstat.dbox_dstmod := c_dbox_mod_pass;
            nstat.aunit_dstmod := c_aunit_mod_pass;
            nstat.dbox_cimod  := c_dbox_mod_one;
            nstat.aunit_cimod  := c_aunit_mod_one;
          when "011" =>                 -- DEC:   ~0 +  DST + 0   (dst-1)
          when "011" =>                 -- DEC:   ~0 +  DST + 0   (dst-1)
            is_dstm := '1';
            is_dstm := '1';
            nstat.dbox_srcmod := c_dbox_mod_one;
            nstat.aunit_srcmod := c_aunit_mod_one;
            nstat.dbox_dstmod := c_dbox_mod_pass;
            nstat.aunit_dstmod := c_aunit_mod_pass;
            nstat.dbox_cimod  := c_dbox_mod_zero;
            nstat.aunit_cimod  := c_aunit_mod_zero;
          when "100" =>                 -- NEG:    0 + ~DST + 1   (-dst)
          when "100" =>                 -- NEG:    0 + ~DST + 1   (-dst)
            is_dstm := '1';
            is_dstm := '1';
            nstat.dbox_srcmod := c_dbox_mod_zero;
            nstat.aunit_srcmod := c_aunit_mod_zero;
            nstat.dbox_dstmod := c_dbox_mod_inv;
            nstat.aunit_dstmod := c_aunit_mod_inv;
            nstat.dbox_cimod  := c_dbox_mod_one;
            nstat.aunit_cimod  := c_aunit_mod_one;
          when "101" =>                 -- ADC:    0 +  DST + CI  (dst+ci)
          when "101" =>                 -- ADC:    0 +  DST + CI  (dst+ci)
            is_dstm := '1';
            is_dstm := '1';
            nstat.dbox_srcmod := c_dbox_mod_zero;
            nstat.aunit_srcmod := c_aunit_mod_zero;
            nstat.dbox_dstmod := c_dbox_mod_pass;
            nstat.aunit_dstmod := c_aunit_mod_pass;
            nstat.dbox_cimod  := c_dbox_mod_pass;
            nstat.aunit_cimod  := c_aunit_mod_pass;
          when "110" =>                 -- SBC:   ~0 +  DST + ~CI (dst-ci)
          when "110" =>                 -- SBC:   ~0 +  DST + ~CI (dst-ci)
            is_dstm := '1';
            is_dstm := '1';
            nstat.dbox_srcmod := c_dbox_mod_one;
            nstat.aunit_srcmod := c_aunit_mod_one;
            nstat.dbox_dstmod := c_dbox_mod_pass;
            nstat.aunit_dstmod := c_aunit_mod_pass;
            nstat.dbox_cimod  := c_dbox_mod_inv;
            nstat.aunit_cimod  := c_aunit_mod_inv;
          when "111" =>                 -- TST:    0 +  DST + 0   (dst)
          when "111" =>                 -- TST:    0 +  DST + 0   (dst)
            is_dstr := '1';
            is_dstr := '1';
            nstat.dbox_srcmod := c_dbox_mod_zero;
            nstat.aunit_srcmod := c_aunit_mod_zero;
            nstat.dbox_dstmod := c_dbox_mod_pass;
            nstat.aunit_dstmod := c_aunit_mod_pass;
            nstat.dbox_cimod  := c_dbox_mod_zero;
            nstat.aunit_cimod  := c_aunit_mod_zero;
          when others => null;
          when others => null;
        end case;
        end case;
 
 
        nstat.fork_opg := c_fork_opg_gen;
        nstat.fork_opg := c_fork_opg_gen;
        nstat.do_fork_opg := '1';
        nstat.do_fork_opg := '1';
Line 330... Line 331...
          nstat.do_fork_opg := '1';
          nstat.do_fork_opg := '1';
          nstat.do_pref_dec := is_dstmode0notpc;
          nstat.do_pref_dec := is_dstmode0notpc;
          if OPBYTE = '1' then
          if OPBYTE = '1' then
            nstat.is_bytop := '1';
            nstat.is_bytop := '1';
          end if;
          end if;
          nstat.res_sel := c_dpath_res_lbox;
          nstat.res_sel := c_dpath_res_lunit;
          case OPEXT2(1 downto 0) is
          case OPEXT2(1 downto 0) is
            when "00" =>                -- ROR
            when "00" =>                -- ROR
              nstat.lbox_func := c_lbox_func_ror;
              nstat.lunit_func := c_lunit_func_ror;
            when "01" =>                -- ROL
            when "01" =>                -- ROL
              nstat.lbox_func := c_lbox_func_rol;
              nstat.lunit_func := c_lunit_func_rol;
            when "10" =>                -- ASR
            when "10" =>                -- ASR
              nstat.lbox_func := c_lbox_func_asr;
              nstat.lunit_func := c_lunit_func_asr;
            when "11" =>                -- ASL
            when "11" =>                -- ASL
              nstat.lbox_func := c_lbox_func_asl;
              nstat.lunit_func := c_lunit_func_asl;
            when others => null;
            when others => null;
          end case;
          end case;
        end if;
        end if;
 
 
        if OPBYTE='0' and OPEXT2="100" then -- MARK
        if OPBYTE='0' and OPEXT2="100" then -- MARK
Line 356... Line 357...
          nstat.is_res := '0';
          nstat.is_res := '0';
          nstat.force_srcsp := '1';
          nstat.force_srcsp := '1';
          if DSTREG = c_gpr_sp then       -- is dst reg == sp ?
          if DSTREG = c_gpr_sp then       -- is dst reg == sp ?
            nstat.updt_dstadsrc := '1';     -- ensure DSRC update in dsta flow
            nstat.updt_dstadsrc := '1';     -- ensure DSRC update in dsta flow
          end if;
          end if;
          nstat.res_sel := c_dpath_res_abox;
          nstat.res_sel := c_dpath_res_ounit;
          if nstat.is_dstmode0 = '1' then
          if nstat.is_dstmode0 = '1' then
            nstat.fork_opa := c_fork_opa_mfp_reg;
            nstat.fork_opa := c_fork_opa_mfp_reg;
          else
          else
            nstat.fork_opa := c_fork_opa_mfp_mem;
            nstat.fork_opa := c_fork_opa_mfp_mem;
          end if;
          end if;
Line 368... Line 369...
        end if;
        end if;
 
 
        if OPEXT2 = "110" then          -- MTP(I/D)
        if OPEXT2 = "110" then          -- MTP(I/D)
          nstat.is_res := '0';
          nstat.is_res := '0';
          nstat.force_srcsp := '1';
          nstat.force_srcsp := '1';
          nstat.res_sel := c_dpath_res_abox;
          nstat.res_sel := c_dpath_res_ounit;
          nstat.fork_opa := c_fork_opa_mtp;
          nstat.fork_opa := c_fork_opa_mtp;
          nstat.fork_op  := c_fork_op_mtp;
          nstat.fork_op  := c_fork_op_mtp;
          nstat.do_fork_op := '1';
          nstat.do_fork_op := '1';
        end if;
        end if;
 
 
Line 380... Line 381...
          nstat.is_res := '0';
          nstat.is_res := '0';
          is_dstw := '1';
          is_dstw := '1';
          nstat.fork_opg := c_fork_opg_gen;
          nstat.fork_opg := c_fork_opg_gen;
          nstat.do_fork_opg := '1';
          nstat.do_fork_opg := '1';
          nstat.do_pref_dec := is_dstmode0notpc;
          nstat.do_pref_dec := is_dstmode0notpc;
          nstat.lbox_func := c_lbox_func_sxt;
          nstat.lunit_func := c_lunit_func_sxt;
          nstat.res_sel := c_dpath_res_lbox;
          nstat.res_sel := c_dpath_res_lunit;
        end if;
        end if;
      end if;
      end if;
 
 
    end if; -- OPPRIM="000"
    end if; -- OPPRIM="000"
 
 
Line 394... Line 395...
      case OPPRIM is
      case OPPRIM is
        when "001" =>                   -- MOV
        when "001" =>                   -- MOV
          is_srcr := '1';
          is_srcr := '1';
          is_dstw := '1';
          is_dstw := '1';
          nstat.op_mov := '1';
          nstat.op_mov := '1';
          nstat.lbox_func := c_lbox_func_mov;
          nstat.lunit_func := c_lunit_func_mov;
          nstat.res_sel  := c_dpath_res_lbox;
          nstat.res_sel  := c_dpath_res_lunit;
          nstat.is_bytop := OPBYTE;
          nstat.is_bytop := OPBYTE;
        when "010" =>                   -- CMP
        when "010" =>                   -- CMP
          is_srcr := '1';
          is_srcr := '1';
          is_dstr := '1';
          is_dstr := '1';
          nstat.res_sel  := c_dpath_res_dbox;
          nstat.res_sel  := c_dpath_res_aunit;
          nstat.dbox_srcmod := c_dbox_mod_pass;
          nstat.aunit_srcmod := c_aunit_mod_pass;
          nstat.dbox_dstmod := c_dbox_mod_inv;
          nstat.aunit_dstmod := c_aunit_mod_inv;
          nstat.dbox_cimod  := c_dbox_mod_one;
          nstat.aunit_cimod  := c_aunit_mod_one;
          nstat.is_bytop := OPBYTE;
          nstat.is_bytop := OPBYTE;
        when "011" =>                   -- BIT
        when "011" =>                   -- BIT
          is_srcr := '1';
          is_srcr := '1';
          is_dstr := '1';
          is_dstr := '1';
          nstat.lbox_func := c_lbox_func_bit;
          nstat.lunit_func := c_lunit_func_bit;
          nstat.res_sel  := c_dpath_res_lbox;
          nstat.res_sel  := c_dpath_res_lunit;
          nstat.is_bytop := OPBYTE;
          nstat.is_bytop := OPBYTE;
        when "100" =>                   -- BIC
        when "100" =>                   -- BIC
          is_srcr := '1';
          is_srcr := '1';
          is_dstm := '1';
          is_dstm := '1';
          nstat.lbox_func := c_lbox_func_bic;
          nstat.lunit_func := c_lunit_func_bic;
          nstat.res_sel  := c_dpath_res_lbox;
          nstat.res_sel  := c_dpath_res_lunit;
          nstat.is_bytop := OPBYTE;
          nstat.is_bytop := OPBYTE;
        when "101" =>                   -- BIS
        when "101" =>                   -- BIS
          is_srcr := '1';
          is_srcr := '1';
          is_dstm := '1';
          is_dstm := '1';
          nstat.lbox_func := c_lbox_func_bis;
          nstat.lunit_func := c_lunit_func_bis;
          nstat.res_sel  := c_dpath_res_lbox;
          nstat.res_sel  := c_dpath_res_lunit;
          nstat.is_bytop := OPBYTE;
          nstat.is_bytop := OPBYTE;
        when "110" =>
        when "110" =>
          is_srcr := '1';
          is_srcr := '1';
          is_dstm := '1';
          is_dstm := '1';
          nstat.res_sel    := c_dpath_res_dbox;
          nstat.res_sel    := c_dpath_res_aunit;
          if OPBYTE = '0' then          -- ADD
          if OPBYTE = '0' then          -- ADD
            nstat.dbox_srcmod := c_dbox_mod_pass;
            nstat.aunit_srcmod := c_aunit_mod_pass;
            nstat.dbox_dstmod := c_dbox_mod_pass;
            nstat.aunit_dstmod := c_aunit_mod_pass;
            nstat.dbox_cimod  := c_dbox_mod_zero;
            nstat.aunit_cimod  := c_aunit_mod_zero;
          else                          -- SUB
          else                          -- SUB
            nstat.dbox_srcmod := c_dbox_mod_inv;
            nstat.aunit_srcmod := c_aunit_mod_inv;
            nstat.dbox_dstmod := c_dbox_mod_pass;
            nstat.aunit_dstmod := c_aunit_mod_pass;
            nstat.dbox_cimod  := c_dbox_mod_one;
            nstat.aunit_cimod  := c_aunit_mod_one;
          end if;
          end if;
        when others => null;
        when others => null;
      end case;
      end case;
 
 
      nstat.fork_opg := c_fork_opg_gen;
      nstat.fork_opg := c_fork_opg_gen;
Line 450... Line 451...
    if OPBYTE='0' and OPPRIM="111" then
    if OPBYTE='0' and OPPRIM="111" then
      case OPEXT1 is
      case OPEXT1 is
        when "000" =>                   -- MUL
        when "000" =>                   -- MUL
          nstat.is_res := '0';
          nstat.is_res := '0';
          is_dstr := '1';
          is_dstr := '1';
          nstat.mbox_func := c_mbox_func_mul;
          nstat.munit_func := c_munit_func_mul;
          nstat.res_sel := c_dpath_res_mbox;
          nstat.res_sel := c_dpath_res_munit;
          nstat.fork_opg := c_fork_opg_mul;
          nstat.fork_opg := c_fork_opg_mul;
          nstat.do_fork_opg := '1';
          nstat.do_fork_opg := '1';
        when "001" =>                   -- DIV
        when "001" =>                   -- DIV
          nstat.is_res := '0';
          nstat.is_res := '0';
          is_dstr := '1';
          is_dstr := '1';
          nstat.mbox_func := c_mbox_func_div;
          nstat.munit_func := c_munit_func_div;
          nstat.res_sel := c_dpath_res_mbox;
          nstat.res_sel := c_dpath_res_munit;
          nstat.fork_opg := c_fork_opg_div;
          nstat.fork_opg := c_fork_opg_div;
          nstat.do_fork_opg := '1';
          nstat.do_fork_opg := '1';
        when "010" =>                   -- ASH
        when "010" =>                   -- ASH
          nstat.is_res := '0';
          nstat.is_res := '0';
          is_dstr := '1';
          is_dstr := '1';
          nstat.mbox_func := c_mbox_func_ash;
          nstat.munit_func := c_munit_func_ash;
          nstat.res_sel := c_dpath_res_mbox;
          nstat.res_sel := c_dpath_res_munit;
          nstat.fork_opg := c_fork_opg_ash;
          nstat.fork_opg := c_fork_opg_ash;
          nstat.do_fork_opg := '1';
          nstat.do_fork_opg := '1';
        when "011" =>                   -- ASHC
        when "011" =>                   -- ASHC
          nstat.is_res := '0';
          nstat.is_res := '0';
          is_dstr := '1';
          is_dstr := '1';
          nstat.mbox_func := c_mbox_func_ashc;
          nstat.munit_func := c_munit_func_ashc;
          nstat.res_sel := c_dpath_res_mbox;
          nstat.res_sel := c_dpath_res_munit;
          nstat.fork_opg := c_fork_opg_ashc;
          nstat.fork_opg := c_fork_opg_ashc;
          nstat.do_fork_opg := '1';
          nstat.do_fork_opg := '1';
        when "100" =>                   -- XOR
        when "100" =>                   -- XOR
          nstat.is_res := '0';
          nstat.is_res := '0';
          is_dstm := '1';
          is_dstm := '1';
          nstat.lbox_func := c_lbox_func_xor;
          nstat.lunit_func := c_lunit_func_xor;
          nstat.res_sel := c_dpath_res_lbox;
          nstat.res_sel := c_dpath_res_lunit;
          nstat.fork_opg := c_fork_opg_gen;
          nstat.fork_opg := c_fork_opg_gen;
          nstat.do_fork_opg := '1';
          nstat.do_fork_opg := '1';
          nstat.do_pref_dec := is_dstmode0notpc;
          nstat.do_pref_dec := is_dstmode0notpc;
        when "111" =>                   -- SOB:  SRC +   ~0 + 0   (src-1)
        when "111" =>                   -- SOB:  SRC +   ~0 + 0   (src-1)
          nstat.is_res := '0';
          nstat.is_res := '0';
          nstat.dbox_srcmod := c_dbox_mod_pass;
          nstat.aunit_srcmod := c_aunit_mod_pass;
          nstat.dbox_dstmod := c_dbox_mod_one;
          nstat.aunit_dstmod := c_aunit_mod_one;
          nstat.dbox_cimod  := c_dbox_mod_zero;
          nstat.aunit_cimod  := c_aunit_mod_zero;
          nstat.res_sel := c_dpath_res_dbox;
          nstat.res_sel := c_dpath_res_aunit;
          nstat.fork_op := c_fork_op_sob;
          nstat.fork_op := c_fork_op_sob;
          nstat.do_fork_op := '1';
          nstat.do_fork_op := '1';
        when others => null;
        when others => null;
      end case;
      end case;
 
 

powered by: WebSVN 2.1.0

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