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

Subversion Repositories mlite

[/] [mlite/] [trunk/] [vhdl/] [bus_mux.vhd] - Diff between revs 128 and 139

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

Rev 128 Rev 139
Line 29... Line 29...
        b_mux        : in  b_source_type;
        b_mux        : in  b_source_type;
        b_out        : out std_logic_vector(31 downto 0);
        b_out        : out std_logic_vector(31 downto 0);
 
 
        c_bus        : in  std_logic_vector(31 downto 0);
        c_bus        : in  std_logic_vector(31 downto 0);
        c_memory     : in  std_logic_vector(31 downto 0);
        c_memory     : in  std_logic_vector(31 downto 0);
        c_pc         : in  std_logic_vector(31 downto 0);
        c_pc         : in  std_logic_vector(31 downto 2);
        c_pc_plus4   : in  std_logic_vector(31 downto 0);
        c_pc_plus4   : in  std_logic_vector(31 downto 2);
        c_mux        : in  c_source_type;
        c_mux        : in  c_source_type;
        reg_dest_out : out std_logic_vector(31 downto 0);
        reg_dest_out : out std_logic_vector(31 downto 0);
 
 
        branch_func  : in  branch_function_type;
        branch_func  : in  branch_function_type;
        take_branch  : out std_logic);
        take_branch  : out std_logic);
end; --entity bus_mux
end; --entity bus_mux
 
 
architecture logic of bus_mux is
architecture logic of bus_mux is
begin
begin
 
 
 
--Determine value of a_bus
amux: process(reg_source, imm_in, a_mux, c_pc)
amux: process(reg_source, imm_in, a_mux, c_pc)
begin
begin
   case a_mux is
   case a_mux is
   when A_FROM_REG_SOURCE =>
   when A_FROM_REG_SOURCE =>
      a_out <= reg_source;
      a_out <= reg_source;
   when A_FROM_IMM10_6 =>
   when A_FROM_IMM10_6 =>
      a_out <= ZERO(31 downto 5) & imm_in(10 downto 6);
      a_out <= ZERO(31 downto 5) & imm_in(10 downto 6);
   when A_FROM_PC =>
   when A_FROM_PC =>
      a_out <= c_pc;
      a_out <= c_pc & "00";
   when others =>
   when others =>
      a_out <= c_pc;
      a_out <= c_pc & "00";
   end case;
   end case;
end process;
end process;
 
 
 
--Determine value of b_bus
bmux: process(reg_target, imm_in, b_mux)
bmux: process(reg_target, imm_in, b_mux)
begin
begin
   case b_mux is
   case b_mux is
   when B_FROM_REG_TARGET =>
   when B_FROM_REG_TARGET =>
      b_out <= reg_target;
      b_out <= reg_target;
Line 81... Line 83...
   when others =>
   when others =>
      b_out <= reg_target;
      b_out <= reg_target;
   end case;
   end case;
end process;
end process;
 
 
 
--Determine value of c_bus                                                              
cmux: process(c_bus, c_memory, c_pc, c_pc_plus4, imm_in, c_mux)
cmux: process(c_bus, c_memory, c_pc, c_pc_plus4, imm_in, c_mux)
begin
begin
   case c_mux is
   case c_mux is
   when C_FROM_ALU =>  -- | C_FROM_SHIFT | C_FROM_MULT =>
   when C_FROM_ALU =>  -- | C_FROM_SHIFT | C_FROM_MULT =>
      reg_dest_out <= c_bus;
      reg_dest_out <= c_bus;
   when C_FROM_MEMORY =>
   when C_FROM_MEMORY =>
      reg_dest_out <= c_memory;
      reg_dest_out <= c_memory;
   when C_FROM_PC =>
   when C_FROM_PC =>
      reg_dest_out <= c_pc(31 downto 3) & "000"; --backup one opcode
      reg_dest_out <= c_pc(31 downto 2) & "00";
   when C_FROM_PC_PLUS4 =>
   when C_FROM_PC_PLUS4 =>
      reg_dest_out <= c_pc_plus4;
      reg_dest_out <= c_pc_plus4 & "00";
   when C_FROM_IMM_SHIFT16 =>
   when C_FROM_IMM_SHIFT16 =>
      reg_dest_out <= imm_in & ZERO(15 downto 0);
      reg_dest_out <= imm_in & ZERO(15 downto 0);
   when others =>
   when others =>
      reg_dest_out <= c_bus;
      reg_dest_out <= c_bus;
   end case;
   end case;
end process;
end process;
 
 
 
--Determine value of take_branch
pc_mux: process(branch_func, reg_source, reg_target)
pc_mux: process(branch_func, reg_source, reg_target)
   variable is_equal : std_logic;
   variable is_equal : std_logic;
begin
begin
   if reg_source = reg_target then
   if reg_source = reg_target then
      is_equal := '1';
      is_equal := '1';
Line 123... Line 127...
   when BRANCH_GTZ =>
   when BRANCH_GTZ =>
      take_branch <= not reg_source(31) and not is_equal;
      take_branch <= not reg_source(31) and not is_equal;
   when BRANCH_YES =>
   when BRANCH_YES =>
      take_branch <= '1';
      take_branch <= '1';
   when others =>
   when others =>
      take_branch <= is_equal;
      take_branch <= '0';
   end case;
   end case;
end process;
end process;
 
 
end; --architecture logic
end; --architecture logic
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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