Skip to content

Commit

Permalink
Remove shared variable from synthesisable code
Browse files Browse the repository at this point in the history
* Avoids WARNING: [Synth 8-4747] shared variables must be of a protected type
* which is an error by default in GHDL
  • Loading branch information
glennchid committed Oct 9, 2024
1 parent 4b7a35b commit a691f10
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions common/hdl/spbram.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,18 @@ end spbram;
architecture rtl of spbram is

type mem_type is array (2**AW-1 downto 0) of std_logic_vector (DW-1 downto 0);
shared variable mem : mem_type := (others => (others => '0'));

begin

process (clka)
process (clka, clkb)
variable mem : mem_type := (others => (others => '0'));
begin
if (clka'event and clka = '1') then
if rising_edge(clka) then
if (wea = '1') then
mem(to_integer(unsigned(addra))) := dina;
end if;
end if;
end process;

process (clkb)
begin
if (clkb'event and clkb = '1') then
if rising_edge(clkb) then
doutb <= mem(to_integer(unsigned(addrb)));
end if;
end process;
Expand Down

0 comments on commit a691f10

Please sign in to comment.