Line 1... |
Line 1... |
-- $Id: pdp11_munit.vhd 330 2010-09-19 17:43:53Z mueller $
|
-- $Id: pdp11_munit.vhd 427 2011-11-19 21:04:11Z mueller $
|
--
|
--
|
-- Copyright 2006-2007 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
-- Copyright 2006-2011 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
|
-- Software Foundation, either version 2, or at your option any later version.
|
-- Software Foundation, either version 2, or at your option any later version.
|
--
|
--
|
Line 16... |
Line 16... |
-- Description: pdp11: mul/div unit for data (munit)
|
-- Description: pdp11: mul/div unit for data (munit)
|
--
|
--
|
-- 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.2, 9.1, 9.2, 13.1; ghdl 0.18-0.29
|
-- Revision History:
|
-- Revision History:
|
-- Date Rev Version Comment
|
-- Date Rev Version Comment
|
|
-- 2011-11-18 427 1.1.1 now numeric_std clean
|
-- 2010-09-18 300 1.1 renamed from mbox
|
-- 2010-09-18 300 1.1 renamed from mbox
|
-- 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;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.numeric_std.all;
|
|
|
use work.slvtypes.all;
|
use work.slvtypes.all;
|
use work.pdp11.all;
|
use work.pdp11.all;
|
|
|
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
Line 97... |
Line 98... |
|
|
begin
|
begin
|
|
|
proc_regs: process (CLK)
|
proc_regs: process (CLK)
|
begin
|
begin
|
if CLK'event and CLK='1' then
|
if rising_edge(CLK) then
|
R_DD_L <= NEXT_DD_L;
|
R_DD_L <= NEXT_DD_L;
|
R_DDO_LT <= NEXT_DDO_LT;
|
R_DDO_LT <= NEXT_DDO_LT;
|
R_DIV_V <= NEXT_DIV_V;
|
R_DIV_V <= NEXT_DIV_V;
|
R_SHC <= NEXT_SHC;
|
R_SHC <= NEXT_SHC;
|
R_C1 <= NEXT_C1;
|
R_C1 <= NEXT_C1;
|
Line 150... |
Line 151... |
NEXT_C1 <= '1';
|
NEXT_C1 <= '1';
|
end if;
|
end if;
|
|
|
if S_DIV_CN='1' or S_ASH_CN='1' or S_ASHC_CN='1' then
|
if S_DIV_CN='1' or S_ASH_CN='1' or S_ASHC_CN='1' then
|
if R_SHC(5) = '0' then
|
if R_SHC(5) = '0' then
|
NEXT_SHC <= unsigned(R_SHC) - 1;
|
NEXT_SHC <= slv(unsigned(R_SHC) - 1);
|
else
|
else
|
NEXT_SHC <= unsigned(R_SHC) + 1;
|
NEXT_SHC <= slv(unsigned(R_SHC) + 1);
|
end if;
|
end if;
|
NEXT_C1 <= '0';
|
NEXT_C1 <= '0';
|
end if;
|
end if;
|
|
|
SHC_TC_L <= '0';
|
SHC_TC_L <= '0';
|
Line 208... |
Line 209... |
else
|
else
|
subadd := Q(0);
|
subadd := Q(0);
|
end if;
|
end if;
|
|
|
if subadd = '0' then
|
if subadd = '0' then
|
dd_h_new := signed(dd_h_old) + signed(DR);
|
dd_h_new := slv(signed(dd_h_old) + signed(DR));
|
else
|
else
|
dd_h_new := signed(dd_h_old) - signed(DR);
|
dd_h_new := slv(signed(dd_h_old) - signed(DR));
|
end if;
|
end if;
|
|
|
dd_gt := '0';
|
dd_gt := '0';
|
if dd_h_new(15) = '0' and
|
if dd_h_new(15) = '0' and
|
(unsigned(dd_h_new(14 downto 0))/=0 or
|
(unsigned(dd_h_new(14 downto 0))/=0 or
|
Line 302... |
Line 303... |
|
|
variable mul_c : slbit := '0';
|
variable mul_c : slbit := '0';
|
|
|
begin
|
begin
|
|
|
prod := signed(DSRC) * signed(DDST);
|
prod := slv(signed(DSRC) * signed(DDST));
|
|
|
case FUNC is
|
case FUNC is
|
when c_munit_func_mul =>
|
when c_munit_func_mul =>
|
omux_sel := "00";
|
omux_sel := "00";
|
when c_munit_func_div =>
|
when c_munit_func_div =>
|