Line 101... |
Line 101... |
-- Write Access ---------------------------------------------------------------------------
|
-- Write Access ---------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
-- -------------------------------------------------------------------------------------------
|
wr_access: process(clk_i)
|
wr_access: process(clk_i)
|
begin
|
begin
|
if rising_edge(clk_i) then
|
if rising_edge(clk_i) then
|
-- mtimecmp --
|
-- mtimecmp low --
|
if (wren = '1') then
|
if (wren = '1') and (addr = mtime_cmp_lo_addr_c) then
|
if (addr = mtime_cmp_lo_addr_c) then -- low
|
|
mtimecmp_lo <= data_i;
|
mtimecmp_lo <= data_i;
|
end if;
|
end if;
|
if (addr = mtime_cmp_hi_addr_c) then -- high
|
|
|
-- mtimecmp high --
|
|
if (wren = '1') and (addr = mtime_cmp_hi_addr_c) then
|
mtimecmp_hi <= data_i;
|
mtimecmp_hi <= data_i;
|
end if;
|
end if;
|
end if;
|
|
|
|
-- mtime low --
|
-- mtime low --
|
if (wren = '1') and (addr = mtime_time_lo_addr_c) then
|
if (wren = '1') and (addr = mtime_time_lo_addr_c) then
|
mtime_lo_msb_ff <= '0';
|
mtime_lo_msb_ff <= '0';
|
mtime_lo <= '0' & data_i;
|
mtime_lo <= '0' & data_i;
|
Line 138... |
Line 138... |
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 <= acc_en and (rden_i or wren_i);
|
data_o <= (others => '0'); -- default
|
data_o <= (others => '0'); -- default
|
if (rden_i = '1') and (acc_en = '1') then
|
if (rden_i = '1') and (acc_en = '1') then
|
if (addr = mtime_time_lo_addr_c) then -- mtime LOW
|
case addr is
|
|
when mtime_time_lo_addr_c => -- mtime LOW
|
data_o <= mtime_lo(31 downto 00);
|
data_o <= mtime_lo(31 downto 00);
|
elsif (addr = mtime_time_hi_addr_c) then -- mtime HIGH
|
when mtime_time_hi_addr_c => -- mtime HIGH
|
data_o <= mtime_hi;
|
data_o <= mtime_hi;
|
elsif (addr = mtime_cmp_lo_addr_c) then -- mtimecmp LOW
|
when mtime_cmp_lo_addr_c => -- mtimecmp LOW
|
data_o <= mtimecmp_lo;
|
data_o <= mtimecmp_lo;
|
else -- (addr = mtime_cmp_hi_addr_c) then -- mtimecmp HIGH
|
when mtime_cmp_hi_addr_c => -- mtimecmp HIGH
|
data_o <= mtimecmp_hi;
|
data_o <= mtimecmp_hi;
|
end if;
|
when others =>
|
|
data_o <= (others => '0');
|
|
end case;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process rd_access;
|
end process rd_access;
|
|
|
-- time output for cpu --
|
-- time output for cpu --
|