fpga: aps6404l device model: Print message instead of failing for out of bounds accesses
This commit is contained in:
parent
539d2e0908
commit
4ca35ca18c
@ -130,8 +130,13 @@ begin
|
|||||||
print(" Addr: " & to_hstring(bytes(1)) & to_hstring(bytes(2)) & to_hstring(bytes(3)));
|
print(" Addr: " & to_hstring(bytes(1)) & to_hstring(bytes(2)) & to_hstring(bytes(3)));
|
||||||
addr := to_integer(unsigned(std_logic_vector'(bytes(1), bytes(2), bytes(3))));
|
addr := to_integer(unsigned(std_logic_vector'(bytes(1), bytes(2), bytes(3))));
|
||||||
elsif bytecnt > 4 then
|
elsif bytecnt > 4 then
|
||||||
|
if addr < SIZE then
|
||||||
dout := mem(addr);
|
dout := mem(addr);
|
||||||
print(" Read " & integer'image(addr) & ": " & to_hstring(mem(addr)));
|
print(" Read " & integer'image(addr) & ": " & to_hstring(mem(addr)));
|
||||||
|
else
|
||||||
|
dout := (others => 'X');
|
||||||
|
print(" Read " & integer'image(addr) & ": OUT-OF-BOUNDS");
|
||||||
|
end if;
|
||||||
addr := addr + 1;
|
addr := addr + 1;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
@ -141,7 +146,11 @@ begin
|
|||||||
addr := to_integer(unsigned(std_logic_vector'(bytes(1), bytes(2), bytes(3))));
|
addr := to_integer(unsigned(std_logic_vector'(bytes(1), bytes(2), bytes(3))));
|
||||||
elsif bytecnt > 3 then
|
elsif bytecnt > 3 then
|
||||||
print(" Write " & integer'image(addr) & ": " & to_hstring(bytes(bytecnt)));
|
print(" Write " & integer'image(addr) & ": " & to_hstring(bytes(bytecnt)));
|
||||||
|
if (addr < SIZE) then
|
||||||
mem(addr) := bytes(bytecnt);
|
mem(addr) := bytes(bytecnt);
|
||||||
|
else
|
||||||
|
print(" Error: OUT OF BOUNDS access! Ignoring write.");
|
||||||
|
end if;
|
||||||
addr := addr + 1;
|
addr := addr + 1;
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user