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

Subversion Repositories mlite

[/] [mlite/] [trunk/] [vhdl/] [mem_ctrl.vhd] - Diff between revs 95 and 114

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

Rev 95 Rev 114
Line 66... Line 66...
   --than letting the VHDL compiler accurately predict the maximum
   --than letting the VHDL compiler accurately predict the maximum
   --clock speed.
   --clock speed.
   signal address_reg      : std_logic_vector(31 downto 0);
   signal address_reg      : std_logic_vector(31 downto 0);
   signal write_reg        : std_logic;
   signal write_reg        : std_logic;
   signal byte_sel_reg     : std_logic_vector(3 downto 0);
   signal byte_sel_reg     : std_logic_vector(3 downto 0);
 
   signal mem_state_next_sig : mem_state_type;
 
   signal opcode_next_sig    : std_logic_vector(31 downto 0);
 
   signal write_next_sig     : std_logic;
 
   signal byte_sel_next_sig  : std_logic_vector(3 downto 0);
 
 
begin
begin
 
 
 
GEN_REGS: process(clk, reset_in)
 
begin
 
   if reset_in = '1' then
 
      mem_state_reg <= STATE_FETCH;
 
      opcode_reg <= ZERO;
 
      next_opcode_reg <= ZERO;
 
   elsif rising_edge(clk) then
 
      mem_state_reg <= mem_state_next_sig;
 
      opcode_reg <= opcode_next_sig;
 
      if mem_state_reg = STATE_FETCH then
 
         next_opcode_reg <= mem_data_r;
 
      end if;
 
   end if;
 
end process;
 
 
 
GEN_REGS2: process(clk, address_data, write_next_sig, byte_sel_next_sig)
 
begin
 
   if rising_edge(clk) then
 
      if ACCURATE_TIMING then
 
         address_reg <= address_data;
 
         write_reg <= write_next_sig;
 
         byte_sel_reg <= byte_sel_next_sig;
 
      end if;
 
   end if;
 
   if not ACCURATE_TIMING then
 
      address_reg <= address_data;
 
      write_reg <= write_next_sig;
 
      byte_sel_reg <= byte_sel_next_sig;
 
   end if;
 
end process;
 
 
mem_proc: process(clk, reset_in, pause_in, nullify_op,
mem_proc: process(clk, reset_in, pause_in, nullify_op,
                  address_pc, address_data, mem_source, data_write,
                  address_pc, address_data, mem_source, data_write,
                  mem_data_r,
                  mem_data_r,
                  opcode_reg, next_opcode_reg, mem_state_reg,
                  opcode_reg, next_opcode_reg, mem_state_reg,
                  address_reg, write_reg, byte_sel_reg)
                  address_reg, write_reg, byte_sel_reg)
Line 150... Line 185...
      when others =>
      when others =>
         byte_sel_next := "0001";
         byte_sel_next := "0001";
      end case;
      end case;
   when others =>
   when others =>
   end case;
   end case;
 
   byte_sel_next_sig <= byte_sel_next;
 
   write_next_sig <= write_next;
 
 
   opcode_next := opcode_reg;
   opcode_next := opcode_reg;
   case mem_state_reg is             --State Machine
   case mem_state_reg is             --State Machine
   when STATE_FETCH =>
   when STATE_FETCH =>
      address := address_pc;
      address := address_pc;
Line 206... Line 243...
 
 
   if nullify_op = '1' and pause_in = '0' then
   if nullify_op = '1' and pause_in = '0' then
      opcode_next := ZERO;  --NOP after beql
      opcode_next := ZERO;  --NOP after beql
   end if;
   end if;
 
 
 
   mem_state_next_sig <= mem_state_next;
 
   opcode_next_sig <= opcode_next;
 
 
   if reset_in = '1' then
   if reset_in = '1' then
      mem_state_reg <= STATE_FETCH;
 
      opcode_reg <= ZERO;
 
      next_opcode_reg <= ZERO;
 
      write_line := '0';
      write_line := '0';
   elsif rising_edge(clk) then
 
      mem_state_reg <= mem_state_next;
 
      opcode_reg <= opcode_next;
 
      if mem_state_reg = STATE_FETCH then
 
         next_opcode_reg <= mem_data_r;
 
      end if;
 
   end if;
 
 
 
   if rising_edge(clk) then
 
      if ACCURATE_TIMING then
 
         address_reg <= address_data;
 
         write_reg <= write_next;
 
         byte_sel_reg <= byte_sel_next;
 
      end if;
 
   end if;
 
   if not ACCURATE_TIMING then
 
      address_reg <= address_data;
 
      write_reg <= write_next;
 
      byte_sel_reg <= byte_sel_next;
 
   end if;
   end if;
 
 
   opcode_out <= opcode_reg;
   opcode_out <= opcode_reg;
   data_read <= data;
   data_read <= data;
   pause_out <= pause;
   pause_out <= pause;

powered by: WebSVN 2.1.0

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