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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_6_beta/] [rtl/] [vhdl/] [alu.vhd] - Diff between revs 45 and 77

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

Rev 45 Rev 77
Line 1... Line 1...
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--
--
-- The Arithmetic Logic Unit (ALU).
-- The Arithmetic Logic Unit (ALU).
-- It contains the ALU core plus the Accumulator and the Temp Reg.
-- It contains the ALU core plus the Accumulator and the Temp Reg.
--
--
-- $Id: alu.vhd,v 1.7 2004-04-07 22:09:03 arniml Exp $
-- $Id: alu.vhd,v 1.8 2004-04-24 23:43:56 arniml Exp $
--
--
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
--
--
-- All rights reserved
-- All rights reserved
--
--
Line 79... Line 79...
 
 
end alu;
end alu;
 
 
 
 
library ieee;
library ieee;
use ieee.std_logic_arith.all;
use ieee.numeric_std.all;
 
 
use work.t48_pack.clk_active_c;
use work.t48_pack.clk_active_c;
use work.t48_pack.res_active_c;
use work.t48_pack.res_active_c;
use work.t48_pack.bus_idle_level_c;
use work.t48_pack.bus_idle_level_c;
use work.t48_pack.nibble_t;
use work.t48_pack.nibble_t;
Line 295... Line 295...
                  alu_op_i,
                  alu_op_i,
                  carry_i,
                  carry_i,
                  use_carry_i)
                  use_carry_i)
 
 
    variable add_a_v, add_b_v : alu_operand_t;
    variable add_a_v, add_b_v : alu_operand_t;
    variable result_v         : alu_operand_t;
    variable c_v              : alu_operand_t;
    variable c_v              : std_logic;
    variable result_v         : UNSIGNED(alu_operand_t'range);
    variable aux_c_v          : std_logic_vector(1 downto 0);
    variable aux_c_v          : std_logic_vector(1 downto 0);
 
 
  begin
  begin
    -- Carry Selection --------------------------------------------------------
    -- Carry Selection --------------------------------------------------------
    if use_carry_i then
    c_v      := (others => '0');
      c_v := carry_i;
    if use_carry_i and carry_i = '1' then
    else
      c_v(0) := '1';
      c_v := '0';
 
    end if;
    end if;
 
 
    -- Operand Selection ------------------------------------------------------
    -- Operand Selection ------------------------------------------------------
    -- defaults for ADD
    -- defaults for ADD
    add_a_v := '0' & in_a_s;
    add_a_v := '0' & in_a_s;
    add_b_v := '0' & in_b_s;
    add_b_v := '0' & in_b_s;
 
 
    case alu_op_i is
    case alu_op_i is
      when ALU_INC =>
      when ALU_INC =>
        add_b_v := "000000001";
        add_b_v    := (others => '0');
 
        add_b_v(0) := '1';
      when ALU_DEC =>
      when ALU_DEC =>
        add_b_v := "111111111";
        add_b_v    := (others => '1');
      when others =>
      when others =>
        null;
        null;
    end case;
    end case;
 
 
    -- The Adder --------------------------------------------------------------
    -- The Adder --------------------------------------------------------------
    result_v := UNSIGNED(add_a_v) +
    result_v := UNSIGNED(add_a_v) +
                UNSIGNED(add_b_v) +
                UNSIGNED(add_b_v) +
                CONV_UNSIGNED(c_v, alu_operand_t'length);
                UNSIGNED(c_v);
 
 
    add_result_s <= result_v;
    add_result_s <= std_logic_vector(result_v);
 
 
    -- Auxiliary Carry --------------------------------------------------------
    -- Auxiliary Carry --------------------------------------------------------
    aux_c_v           := in_a_s(4) & in_b_s(4);
    aux_c_v           := in_a_s(4) & in_b_s(4);
 
 
    aux_carry_o       <= '0';
    aux_carry_o       <= '0';
Line 417... Line 417...
 
 
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- File History:
-- File History:
--
--
-- $Log: not supported by cvs2svn $
-- $Log: not supported by cvs2svn $
 
-- Revision 1.7  2004/04/07 22:09:03  arniml
 
-- remove unused signals
 
--
-- Revision 1.6  2004/04/07 20:56:23  arniml
-- Revision 1.6  2004/04/07 20:56:23  arniml
-- default assignment for aux_carry_o
-- default assignment for aux_carry_o
--
--
-- Revision 1.5  2004/04/06 20:21:53  arniml
-- Revision 1.5  2004/04/06 20:21:53  arniml
-- fix sensitivity list
-- fix sensitivity list

powered by: WebSVN 2.1.0

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