-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
92 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
use ieee.numeric_std.all; | ||
|
||
entity bram_dual_port is | ||
generic ( | ||
C_DATA_WIDTH : integer := 8; | ||
C_ADDR_WIDTH : integer := 9 | ||
); | ||
port ( | ||
isl_wclk : in std_logic; | ||
isl_rclk : in std_logic; | ||
isl_we : in std_logic; | ||
islv_waddr : in std_logic_vector(C_ADDR_WIDTH - 1 downto 0); | ||
islv_data : in std_logic_vector(C_DATA_WIDTH - 1 downto 0); | ||
islv_raddr : in std_logic_vector(C_ADDR_WIDTH - 1 downto 0); | ||
oslv_data : out std_logic_vector(C_DATA_WIDTH - 1 downto 0) | ||
); | ||
end entity bram_dual_port; | ||
|
||
architecture behavioral of bram_dual_port is | ||
|
||
type t_ram is array(0 to 2 ** C_ADDR_WIDTH - 1) of std_logic_vector(C_DATA_WIDTH - 1 downto 0); | ||
|
||
signal a_ram : t_ram; | ||
|
||
begin | ||
|
||
proc_write : process (isl_wclk) is | ||
begin | ||
|
||
if (rising_edge(isl_wclk)) then | ||
if (isl_we = '1') then | ||
a_ram(to_integer(unsigned(islv_waddr))) <= islv_data; | ||
end if; | ||
end if; | ||
|
||
end process proc_write; | ||
|
||
proc_read : process (isl_rclk) is | ||
begin | ||
|
||
if (rising_edge(isl_rclk)) then | ||
oslv_data <= a_ram(to_integer(unsigned(islv_raddr))); | ||
end if; | ||
|
||
end process proc_read; | ||
|
||
end architecture behavioral; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
use ieee.numeric_std.all; | ||
|
||
entity brom is | ||
generic ( | ||
C_DATA_WIDTH : integer := 8; | ||
C_ADDR_WIDTH : integer := 9; | ||
C_INIT_VALUE : std_logic_vector(C_ADDR_WIDTH * C_DATA_WIDTH - 1 downto 0) := (others => '1') | ||
); | ||
port ( | ||
islv_addr : in std_logic_vector(C_ADDR_WIDTH - 1 downto 0); | ||
oslv_data : out std_logic_vector(C_DATA_WIDTH - 1 downto 0) | ||
); | ||
end entity brom; | ||
|
||
architecture behavioral of brom is | ||
|
||
begin | ||
|
||
proc_bram : process (islv_addr) is | ||
|
||
variable int_addr : integer range 0 to 2 ** C_ADDR_WIDTH - 1; | ||
|
||
begin | ||
|
||
int_addr := to_integer(unsigned(islv_addr)); | ||
oslv_data <= C_INIT_VALUE((int_addr + 1) * C_DATA_WIDTH - 1 downto int_addr * C_DATA_WIDTH); | ||
|
||
end process proc_bram; | ||
|
||
end architecture behavioral; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters