Skip to content
This repository was archived by the owner on Sep 4, 2023. It is now read-only.

Commit 4d016e8

Browse files
committed
Initial commit.
0 parents  commit 4d016e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+35349
-0
lines changed

.gitignore

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
db
2+
greybox_tmp
3+
incremental_db
4+
output_files
5+
simulation
6+
hc_output
7+
scaler
8+
hps_isw_handoff
9+
vip
10+
*_sim
11+
.qsys_edit
12+
PLLJ_PLLSPE_INFO.txt
13+
*.bak
14+
*.orig
15+
*.rej
16+
*.qdf
17+
*.rpt
18+
*.smsg
19+
*.summary
20+
*.done
21+
*.jdi
22+
*.pin
23+
*.sof
24+
*.qws
25+
*.ppf
26+
*.ddb
27+
build_id.v
28+
c5_pin_model_dump.txt
29+
*.sopcinfo
30+
*.csv
31+
*.f
32+
*.cmp
33+
*.sip
34+
*.spd
35+
*.bsf
36+
*~
37+
*.xml
38+
*_netlist

DualPortDualClockRAM.vhd

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
-- Generic dual-port RAM implementation -
2+
-- will hopefully work for both Altera and Xilinx parts
3+
4+
library ieee;
5+
USE ieee.std_logic_1164.all;
6+
use ieee.numeric_std.all;
7+
8+
9+
ENTITY DualPortDualClockRAM IS
10+
GENERIC
11+
(
12+
addrbits : integer := 11;
13+
databits : integer := 18
14+
);
15+
PORT
16+
(
17+
address_a : IN STD_LOGIC_VECTOR (addrbits-1 downto 0);
18+
address_b : IN STD_LOGIC_VECTOR (addrbits-1 downto 0);
19+
clock_a : IN STD_LOGIC := '1';
20+
clock_b : IN STD_LOGIC := '1';
21+
data_a : IN STD_LOGIC_VECTOR (databits-1 downto 0);
22+
data_b : IN STD_LOGIC_VECTOR (databits-1 downto 0);
23+
wren_a : IN STD_LOGIC := '0';
24+
wren_b : IN STD_LOGIC := '0';
25+
q_a : OUT STD_LOGIC_VECTOR (databits-1 downto 0);
26+
q_b : OUT STD_LOGIC_VECTOR (databits-1 downto 0)
27+
);
28+
END DualPortDualClockRAM;
29+
30+
architecture arch of DualPortDualClockRAM is
31+
32+
type ram_type is array(natural range ((2**addrbits)-1) downto 0) of std_logic_vector(databits-1 downto 0);
33+
shared variable ram : ram_type;
34+
35+
begin
36+
37+
-- Port A
38+
process (clock_a)
39+
begin
40+
if (clock_a'event and clock_a = '1') then
41+
if wren_a='1' then
42+
ram(to_integer(unsigned(address_a))) := data_a;
43+
q_a <= data_a;
44+
else
45+
q_a <= ram(to_integer(unsigned(address_a)));
46+
end if;
47+
end if;
48+
end process;
49+
50+
-- Port B
51+
process (clock_b)
52+
begin
53+
if (clock_b'event and clock_b = '1') then
54+
if wren_b='1' then
55+
ram(to_integer(unsigned(address_b))) := data_b;
56+
q_b <= data_b;
57+
else
58+
q_b <= ram(to_integer(unsigned(address_b)));
59+
end if;
60+
end if;
61+
end process;
62+
63+
64+
end architecture;

0 commit comments

Comments
 (0)