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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [rtl/] [w11a/] [pdp11_aunit.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_dbox.vhd 314 2010-07-09 17:38:41Z mueller $
-- $Id: pdp11_aunit.vhd 330 2010-09-19 17:43:53Z mueller $
--
--
-- Copyright 2006-2007 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2006-2007 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 10... Line 10...
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-- for complete details.
-- for complete details.
--
--
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Module Name:    pdp11_dbox - syn
-- Module Name:    pdp11_aunit - syn
-- Description:    pdp11: arithmetic unit for data (dbox)
-- Description:    pdp11: arithmetic unit for data (aunit)
--
--
-- Dependencies:   -
-- Dependencies:   -
-- 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, 12.1; ghdl 0.18-0.26
-- Revision History: 
-- Revision History: 
-- Date         Rev Version  Comment
-- Date         Rev Version  Comment
 
-- 2010-09-18   300   1.1    renamed from abox
-- 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 
------------------------------------------------------------------------------
------------------------------------------------------------------------------
 
 
library ieee;
library ieee;
Line 46... Line 47...
--   INC:    0 +  DST + 1   (dst+1)
--   INC:    0 +  DST + 1   (dst+1)
--   DEC:   ~0 +  DST + 0   (dst-1)
--   DEC:   ~0 +  DST + 0   (dst-1)
--   CLR:    0 +    0 + 0   (0)
--   CLR:    0 +    0 + 0   (0)
--   SOB:  SRC +   ~0 + 0   (src-1)
--   SOB:  SRC +   ~0 + 0   (src-1)
 
 
entity pdp11_dbox is                    -- arithmetic unit for data (dbox)
entity pdp11_aunit is                   -- arithmetic unit for data (aunit)
  port (
  port (
    DSRC : in slv16;                    -- 'src' data in
    DSRC : in slv16;                    -- 'src' data in
    DDST : in slv16;                    -- 'dst' data in
    DDST : in slv16;                    -- 'dst' data in
    CI : in slbit;                      -- carry flag in
    CI : in slbit;                      -- carry flag in
    SRCMOD : in slv2;                   -- src modifier mode
    SRCMOD : in slv2;                   -- src modifier mode
Line 60... Line 61...
    CCMODE : in slv3;                   -- cc mode
    CCMODE : in slv3;                   -- cc mode
    BYTOP : in slbit;                   -- byte operation
    BYTOP : in slbit;                   -- byte operation
    DOUT : out slv16;                   -- data output
    DOUT : out slv16;                   -- data output
    CCOUT : out slv4                    -- condition codes out
    CCOUT : out slv4                    -- condition codes out
  );
  );
end pdp11_dbox;
end pdp11_aunit;
 
 
architecture syn of pdp11_dbox is
architecture syn of pdp11_aunit is
 
 
-- --------------------------------------
-- --------------------------------------
 
 
begin
begin
 
 
Line 116... Line 117...
    end procedure do_add8_ci_co;
    end procedure do_add8_ci_co;
 
 
  begin
  begin
 
 
    case SRCMOD is
    case SRCMOD is
      when c_dbox_mod_pass => msrc := DSRC;
      when c_aunit_mod_pass => msrc := DSRC;
      when c_dbox_mod_inv  => msrc := not DSRC;
      when c_aunit_mod_inv  => msrc := not DSRC;
      when c_dbox_mod_zero => msrc := (others=>'0');
      when c_aunit_mod_zero => msrc := (others=>'0');
      when c_dbox_mod_one  => msrc := (others=>'1');
      when c_aunit_mod_one  => msrc := (others=>'1');
      when others => null;
      when others => null;
    end case;
    end case;
 
 
    case DSTMOD is
    case DSTMOD is
      when c_dbox_mod_pass => mdst := DDST;
      when c_aunit_mod_pass => mdst := DDST;
      when c_dbox_mod_inv  => mdst := not DDST;
      when c_aunit_mod_inv  => mdst := not DDST;
      when c_dbox_mod_zero => mdst := (others=>'0');
      when c_aunit_mod_zero => mdst := (others=>'0');
      when c_dbox_mod_one  => mdst := (others=>'1');
      when c_aunit_mod_one  => mdst := (others=>'1');
      when others => null;
      when others => null;
    end case;
    end case;
 
 
    case CIMOD is
    case CIMOD is
      when c_dbox_mod_pass => mci := CI;
      when c_aunit_mod_pass => mci := CI;
      when c_dbox_mod_inv  => mci := not CI;
      when c_aunit_mod_inv  => mci := not CI;
      when c_dbox_mod_zero => mci := '0';
      when c_aunit_mod_zero => mci := '0';
      when c_dbox_mod_one  => mci := '1';
      when c_aunit_mod_one  => mci := '1';
      when others => null;
      when others => null;
    end case;
    end case;
 
 
    do_add8_ci_co(msrc(7 downto 0), mdst(7 downto 0), mci,
    do_add8_ci_co(msrc(7 downto 0), mdst(7 downto 0), mci,
                  sum(7 downto 0), co8);
                  sum(7 downto 0), co8);
Line 187... Line 188...
 
 
    -- the logic for 2 operand V+C is ugly. It is reverse engineered from
    -- the logic for 2 operand V+C is ugly. It is reverse engineered from
    -- the MOD's the operation type.
    -- the MOD's the operation type.
 
 
    if CC1OP = '0' then                 -- 2 operand cases
    if CC1OP = '0' then                 -- 2 operand cases
      if unsigned(CIMOD) = unsigned(c_dbox_mod_zero) then   -- case ADD
      if unsigned(CIMOD) = unsigned(c_aunit_mod_zero) then   -- case ADD
        nvo := not(src_msb xor dst_msb) and (src_msb xor sum_msb);
        nvo := not(src_msb xor dst_msb) and (src_msb xor sum_msb);
      else
      else
        if unsigned(SRCMOD) = unsigned(c_dbox_mod_inv) then -- case SUB 
        if unsigned(SRCMOD) = unsigned(c_aunit_mod_inv) then -- case SUB 
          nvo := (src_msb xor dst_msb) and not (src_msb xor sum_msb);
          nvo := (src_msb xor dst_msb) and not (src_msb xor sum_msb);
        else                                                -- case CMP
        else                                                -- case CMP
          nvo := (src_msb xor dst_msb) and not (dst_msb xor sum_msb);
          nvo := (src_msb xor dst_msb) and not (dst_msb xor sum_msb);
        end if;
        end if;
        nco := not nco;                 -- invert C for SUB and CMP
        nco := not nco;                 -- invert C for SUB and CMP
      end if;
      end if;
 
 
    else                                -- 1 operand cases
    else                                -- 1 operand cases
      case CCMODE is
      case CCMODE is
        when c_dbox_ccmode_clr|c_dbox_ccmode_tst =>
        when c_aunit_ccmode_clr|c_aunit_ccmode_tst =>
          nvo := '0';                     -- force v=0 for tst and clr
          nvo := '0';                     -- force v=0 for tst and clr
          nco := '0';                     -- force c=0 for tst and clr
          nco := '0';                     -- force c=0 for tst and clr
 
 
        when c_dbox_ccmode_com =>
        when c_aunit_ccmode_com =>
          nvo := '0';                     -- force v=0 for com
          nvo := '0';                     -- force v=0 for com
          nco := '1';                     -- force c=1 for com
          nco := '1';                     -- force c=1 for com
 
 
        when c_dbox_ccmode_inc =>
        when c_aunit_ccmode_inc =>
          nvo := sum_msb and not dst_msb;
          nvo := sum_msb and not dst_msb;
          nco := CI;                      -- C not affected for INC
          nco := CI;                      -- C not affected for INC
 
 
        when c_dbox_ccmode_dec =>
        when c_aunit_ccmode_dec =>
          nvo := not sum_msb and dst_msb;
          nvo := not sum_msb and dst_msb;
          nco := CI;                      -- C not affected for DEC
          nco := CI;                      -- C not affected for DEC
 
 
        when c_dbox_ccmode_neg =>
        when c_aunit_ccmode_neg =>
          nvo := sum_msb and dst_msb;
          nvo := sum_msb and dst_msb;
          nco := not nzo;
          nco := not nzo;
 
 
        when c_dbox_ccmode_adc =>
        when c_aunit_ccmode_adc =>
          nvo := sum_msb and not dst_msb;
          nvo := sum_msb and not dst_msb;
 
 
        when c_dbox_ccmode_sbc =>
        when c_aunit_ccmode_sbc =>
          nvo := not sum_msb and dst_msb;
          nvo := not sum_msb and dst_msb;
          nco := not nco;
          nco := not nco;
 
 
        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.