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

Subversion Repositories mlite

[/] [mlite/] [trunk/] [vhdl/] [pipeline.vhd] - Diff between revs 107 and 122

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

Rev 107 Rev 122
Line 46... Line 46...
end; --entity pipeline
end; --entity pipeline
 
 
architecture logic of pipeline is
architecture logic of pipeline is
   signal rd_index_reg     : std_logic_vector(5 downto 0);
   signal rd_index_reg     : std_logic_vector(5 downto 0);
   signal reg_dest_reg     : std_logic_vector(31 downto 0);
   signal reg_dest_reg     : std_logic_vector(31 downto 0);
 
   signal reg_dest_delay   : std_logic_vector(31 downto 0);
   signal c_source_reg     : c_source_type;
   signal c_source_reg     : c_source_type;
   signal pause_enable_reg : std_logic;
   signal pause_enable_reg : std_logic;
begin
begin
 
 
--When operating in three stage pipeline mode, the following signals
--When operating in three stage pipeline mode, the following signals
Line 57... Line 58...
--c_source, and rd_index.
--c_source, and rd_index.
pipeline3: process(clk, reset, a_bus, b_bus, alu_func, shift_func, mult_func,
pipeline3: process(clk, reset, a_bus, b_bus, alu_func, shift_func, mult_func,
      rd_index, rd_index_reg, pause_any, pause_enable_reg,
      rd_index, rd_index_reg, pause_any, pause_enable_reg,
      rs_index, rt_index,
      rs_index, rt_index,
      pc_source, mem_source, a_source, b_source, c_source, c_source_reg,
      pc_source, mem_source, a_source, b_source, c_source, c_source_reg,
      reg_dest, reg_dest_reg, c_bus)
      reg_dest, reg_dest_reg, reg_dest_delay, c_bus)
   variable pause_mult_clock : std_logic;
   variable pause_mult_clock : std_logic;
   variable freeze_pipeline  : std_logic;
   variable freeze_pipeline  : std_logic;
begin
begin
   if (pc_source /= from_inc4 and pc_source /= from_opcode25_0) or
   if (pc_source /= from_inc4 and pc_source /= from_opcode25_0) or
         mem_source /= mem_fetch or
         mem_source /= mem_fetch or
Line 74... Line 75...
   freeze_pipeline := not (pause_mult_clock and pause_enable_reg) and pause_any;
   freeze_pipeline := not (pause_mult_clock and pause_enable_reg) and pause_any;
   pause_pipeline <= pause_mult_clock and pause_enable_reg;
   pause_pipeline <= pause_mult_clock and pause_enable_reg;
   rd_indexD <= rd_index_reg;
   rd_indexD <= rd_index_reg;
 
 
   if c_source_reg = c_from_alu then
   if c_source_reg = c_from_alu then
      reg_destD <= c_bus;
      reg_dest_delay <= c_bus;        --delayed by 1 clock cycle via a_busD & b_busD
   else
   else
      reg_destD <= reg_dest_reg;
      reg_dest_delay <= reg_dest_reg; --need to delay 1 clock cycle from reg_dest
   end if;
   end if;
 
   reg_destD <= reg_dest_delay;
 
 
   if reset = '1' then
   if reset = '1' then
      pause_enable_reg <= '1';
      pause_enable_reg <= '1';
      rd_index_reg <= "000000";
      rd_index_reg <= "000000";
   elsif rising_edge(clk) then
   elsif rising_edge(clk) then
      if freeze_pipeline = '0' then
      if freeze_pipeline = '0' then
         if (rs_index = "000000" or rs_index /= rd_index_reg) or
         if (rs_index = "000000" or rs_index /= rd_index_reg) or
            (a_source /= a_from_reg_source or pause_enable_reg = '0') then
            (a_source /= a_from_reg_source or pause_enable_reg = '0') then
            a_busD <= a_bus;
            a_busD <= a_bus;
         elsif c_source_reg = c_from_alu then
 
            a_busD <= c_bus;  --rs from previous operation (bypass stage)
 
         else
         else
            a_busD <= reg_dest_reg;
            a_busD <= reg_dest_delay;  --rs from previous operation (bypass stage)
         end if;
         end if;
 
 
         if (rt_index = "000000" or rt_index /= rd_index_reg) or
         if (rt_index = "000000" or rt_index /= rd_index_reg) or
               (b_source /= b_from_reg_target or pause_enable_reg = '0') then
               (b_source /= b_from_reg_target or pause_enable_reg = '0') then
            b_busD <= b_bus;
            b_busD <= b_bus;
         elsif c_source_reg = c_from_alu then
 
            b_busD <= c_bus;  --rt from previous operation
 
         else
         else
            b_busD <= reg_dest_reg;
            b_busD <= reg_dest_delay;  --rt from previous operation
         end if;
         end if;
 
 
         alu_funcD <= alu_func;
         alu_funcD <= alu_func;
         shift_funcD <= shift_func;
         shift_funcD <= shift_func;
         mult_funcD <= mult_func;
         mult_funcD <= mult_func;

powered by: WebSVN 2.1.0

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