fpga: aps6404l device model: Print message instead of failing for out of bounds accesses

This commit is contained in:
Markus Koch 2024-11-08 10:29:07 +01:00
parent 539d2e0908
commit 4ca35ca18c

View File

@ -130,8 +130,13 @@ begin
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))));
elsif bytecnt > 4 then
dout := mem(addr);
print(" Read " & integer'image(addr) & ": " & to_hstring(mem(addr)));
if addr < SIZE then
dout := 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;
end if;
@ -141,8 +146,12 @@ begin
addr := to_integer(unsigned(std_logic_vector'(bytes(1), bytes(2), bytes(3))));
elsif bytecnt > 3 then
print(" Write " & integer'image(addr) & ": " & to_hstring(bytes(bytecnt)));
mem(addr) := bytes(bytecnt);
addr := addr + 1;
if (addr < SIZE) then
mem(addr) := bytes(bytecnt);
else
print(" Error: OUT OF BOUNDS access! Ignoring write.");
end if;
addr := addr + 1;
end if;
when COMPLETE =>