dtsao
Newbie level 1
- Joined
- Feb 19, 2013
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,286
0 down vote favorite
I am trying to code a SRAM with 32 bit address, with a Byte lane write enable in VHDL. But when I try to access (read or write) address greater than x1F, I get "Floating point exception 8" when compiling with GHDL. Here is some snippets of the code:
So when I set the address to x0000_001F or lower in the testbench, it compiles, but not when I put x0000_0020 or greater.
I am trying to code a SRAM with 32 bit address, with a Byte lane write enable in VHDL. But when I try to access (read or write) address greater than x1F, I get "Floating point exception 8" when compiling with GHDL. Here is some snippets of the code:
Code:
entity data_mem is
port(addr : in std_logic_vector(31 downto 0);
enable : in std_logic;
rd : in std_logic;
wr : in std_logic;
we : in std_logic_vector( 3 downto 0);
din : in std_logic_vector( 31 downto 0);
-- outputs
dout : out std_logic_vector(31 downto 0);
ack : out std_logic
);
end data_mem;
architecture structure of data_mem is
type mem_type is array (31 downto 0) of std_logic_vector(31 downto 0);
signal mem : mem_type := ((others => (others => '0'))); -- initialize to zero
begin
mem_write : process(addr,enable, wr, we, din)
begin
if (enable = '1') then
if (wr = '1') then
if (we(0) = '1') then
mem(to_integer(signed(addr)))(7 downto 0) <= din(7 downto 0) after 2 ns;
end if; ...
So when I set the address to x0000_001F or lower in the testbench, it compiles, but not when I put x0000_0020 or greater.