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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [core/] [neorv32_mtime.vhd] - Diff between revs 65 and 66

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

Rev 65 Rev 66
Line 67... Line 67...
 
 
  -- access control --
  -- access control --
  signal acc_en : std_ulogic; -- module access enable
  signal acc_en : std_ulogic; -- module access enable
  signal addr   : std_ulogic_vector(31 downto 0); -- access address
  signal addr   : std_ulogic_vector(31 downto 0); -- access address
  signal wren   : std_ulogic; -- module access enable
  signal wren   : std_ulogic; -- module access enable
 
  signal rden   : std_ulogic; -- read enable
 
 
  -- time write access buffer --
  -- time write access buffer --
  signal mtime_lo_we : std_ulogic;
  signal mtime_lo_we : std_ulogic;
  signal mtime_hi_we : std_ulogic;
  signal mtime_hi_we : std_ulogic;
 
 
Line 93... Line 94...
  -- Access Control -------------------------------------------------------------------------
  -- Access Control -------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  acc_en <= '1' when (addr_i(hi_abb_c downto lo_abb_c) = mtime_base_c(hi_abb_c downto lo_abb_c)) else '0';
  acc_en <= '1' when (addr_i(hi_abb_c downto lo_abb_c) = mtime_base_c(hi_abb_c downto lo_abb_c)) else '0';
  addr   <= mtime_base_c(31 downto lo_abb_c) & addr_i(lo_abb_c-1 downto 2) & "00"; -- word aligned
  addr   <= mtime_base_c(31 downto lo_abb_c) & addr_i(lo_abb_c-1 downto 2) & "00"; -- word aligned
  wren   <= acc_en and wren_i;
  wren   <= acc_en and wren_i;
 
  rden   <= acc_en and rden_i;
 
 
 
 
  -- Write Access ---------------------------------------------------------------------------
  -- Write Access ---------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  wr_access: process(clk_i)
  wr_access: process(clk_i)
Line 141... Line 143...
  -- Read Access ----------------------------------------------------------------------------
  -- Read Access ----------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  -- -------------------------------------------------------------------------------------------
  rd_access: process(clk_i)
  rd_access: process(clk_i)
  begin
  begin
    if rising_edge(clk_i) then
    if rising_edge(clk_i) then
      ack_o  <= acc_en and (rden_i or wren_i);
      ack_o  <= rden or wren;
      data_o <= (others => '0'); -- default
      data_o <= (others => '0'); -- default
      if (rden_i = '1') and (acc_en = '1') then
      if (rden = '1') then
        case addr is
        case addr(3 downto 2) is
          when mtime_time_lo_addr_c => -- mtime LOW
          when "00"   => data_o <= mtime_lo; -- mtime LOW
            data_o <= mtime_lo;
          when "01"   => data_o <= mtime_hi; -- mtime HIGH
          when mtime_time_hi_addr_c => -- mtime HIGH
          when "10"   => data_o <= mtimecmp_lo; -- mtimecmp LOW
            data_o <= mtime_hi;
          when others => data_o <= mtimecmp_hi; -- mtimecmp HIGH
          when mtime_cmp_lo_addr_c => -- mtimecmp LOW
 
            data_o <= mtimecmp_lo;
 
          when others => -- mtime_cmp_hi_addr_c -- mtimecmp HIGH
 
            data_o <= mtimecmp_hi;
 
        end case;
        end case;
      end if;
      end if;
    end if;
    end if;
  end process rd_access;
  end process rd_access;
 
 

powered by: WebSVN 2.1.0

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