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

Subversion Repositories mlite

[/] [mlite/] [trunk/] [vhdl/] [mult.vhd] - Diff between revs 90 and 97

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

Rev 90 Rev 97
Line 10... Line 10...
--    Implements the multiplication and division unit.
--    Implements the multiplication and division unit.
--    Division takes 32 clock cycles.
--    Division takes 32 clock cycles.
--    Multiplication normally takes 16 clock cycles.
--    Multiplication normally takes 16 clock cycles.
--    if b <= 0xffff then mult in 8 cycles. 
--    if b <= 0xffff then mult in 8 cycles. 
--    if b <= 0xff then mult in 4 cycles. 
--    if b <= 0xff then mult in 4 cycles. 
 
--
 
-- For multiplication set reg_b = 0x00000000 & b.  The 64-bit result
 
-- will be in reg_b.  The lower bits of reg_b contain the upper 
 
-- bits of b that have not yet been multiplied.  For 16 clock cycles
 
-- shift reg_b two bits to the right.  Use the lowest two bits of reg_b 
 
-- to multiply by two bits at a time and add the result to the upper
 
-- 32-bits of reg_b (using C syntax):
 
--    reg_b = (reg_b >> 2) + (((reg_b & 3) * reg_a) << 32);
 
--
 
-- For division set reg_b = '0' & b & 30_ZEROS.  The answer will be
 
-- in answer_reg and the remainder in reg_a.  For 32 clock cycles
 
-- (using C syntax):
 
--    answer_reg = (answer_reg << 1);
 
--    if (reg_a >= reg_b) {
 
--       answer_reg += 1;
 
--       reg_a -= reg_b;
 
--    }
 
--    reg_b = reg_b >> 1;
---------------------------------------------------------------------
---------------------------------------------------------------------
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all;
use work.mlite_pack.all;
use work.mlite_pack.all;

powered by: WebSVN 2.1.0

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