Add partial support for 8-bit loads
We're big-endian. when we have this in memory: 00 01 02 03 And we need the first byte, we load the first 16-bit word: 0x0001 The first byte is then in the upper part of the word, and requires a right shift by 8. So any load into an 8-bit typed container needs to shift stuff. So far, stores from/to the stack are exempted, they always load/store full 16-bit words. And a few othe rminor things. Like string null terminators. And escaped characters in character literals. Can you believe it's spelled 'literal', with a single t? Me neither.
This commit is contained in:
@@ -121,7 +121,11 @@ begin
|
||||
end if;
|
||||
|
||||
regn_0 := to_integer(unsigned(load_reg(3 downto 0)));
|
||||
reg_d(regn_0) <= mem_in;
|
||||
if load_addr(0) = '1' then -- 8-bit load
|
||||
reg_d(regn_0) <= mem_in(7 downto 0) & x"00";
|
||||
else
|
||||
reg_d(regn_0) <= mem_in;
|
||||
end if;
|
||||
when BRANCH =>
|
||||
inst := x"0000"; -- NOP
|
||||
reg_d(14) <= std_logic_vector(unsigned(reg_q(14)) + 2);
|
||||
|
Reference in New Issue
Block a user