URL
https://opencores.org/ocsvn/uart2bus/uart2bus/trunk
Show entire file |
Details |
Blame |
View Log
Rev 11 |
Rev 13 |
Line 2... |
Line 2... |
-- register file model as a simple memory
|
-- register file model as a simple memory
|
--
|
--
|
-----------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.ALL;
|
use ieee.std_logic_1164.ALL;
|
use ieee.std_logic_unsigned.all;
|
use ieee.numeric_std.all;
|
|
|
entity regFileModel is
|
entity regFileModel is
|
port ( -- global signals
|
port ( -- global signals
|
clr : in std_logic; -- global reset input
|
clr : in std_logic; -- global reset input
|
clk : in std_logic; -- global clock input
|
clk : in std_logic; -- global clock input
|
Line 31... |
Line 31... |
for index in 0 to 255 loop
|
for index in 0 to 255 loop
|
regFile(index) <= (others => '0');
|
regFile(index) <= (others => '0');
|
end loop;
|
end loop;
|
elsif (rising_edge(clk)) then
|
elsif (rising_edge(clk)) then
|
if (intWrite = '1') then
|
if (intWrite = '1') then
|
regFile(conv_integer(intAddress)) <= intWrData;
|
regFile(to_integer(unsigned(intAddress))) <= intWrData;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
-- register file read
|
-- register file read
|
process (clr, clk)
|
process (clr, clk)
|
begin
|
begin
|
if (clr = '1') then
|
if (clr = '1') then
|
intRdData <= (others => '0');
|
intRdData <= (others => '0');
|
elsif (rising_edge(clk)) then
|
elsif (rising_edge(clk)) then
|
if (intRead = '1') then
|
if (intRead = '1') then
|
intRdData <= regFile(conv_integer(intAddress));
|
intRdData <= regFile(to_integer(unsigned(intAddress)));
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
end Behavioral;
|
end Behavioral;
|
|
|
No newline at end of file
|
No newline at end of file
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.