Closed cpldcpu closed 5 years ago
Another potential bug:
opcode encoding for ret # is missing here (0x0200)
and mask should be 0x7E. Alternatively there is a left shift missing.
and mask should be 7e? Something is fishy about the instruction set encoding here. Is the address shifted or is the LSB discarded?
Oh yeah that's fishy :). It's missing a left shift by one.
opcode encoding for ret # is missing here (0x0200)
oh yeah; I remember thinking about that... Must have dropped it or something. Thanks
and mask should be 0x7E. Alternatively there is a left shift missing.
the left shift again...
Thank you and sorry for the wait.
@Rakete1111
According to information by Opossum in the EEV forum, the LSB of the memory location is discarded. Therefore the address for IDXM/LDT/STT should be calculated as below, without a shift:
op |= e.e_addr & 0x7E;
I'm afraid I don't understand. Memory is RAM right, so there are 128 bytes of RAM that are AFAICT byte aligned (why word aligned?) which would mean that only 7 bits are required. There should be no bits discarded.
Although I just noticed that there are some instructions (SET, TSN) that do use a 6 bit memory address. So in that case I'd imagine that the MSB is discarded.
yes, but there are actually only 6 bits to encode the memory address in IDXM/LDT/STT (0x7e=6 bits set!). Hardwiring the LSB of the address to 0 allows accessing all 128 memory locations.
Ahh got it, thanks!
https://github.com/Rakete1111/sdcc-pdk/blob/927264c1e9a893fec38d4dd402a3661a16bfa7c6/sdas/aspdk/pdkmch.c#L92
and mask should be 7e? Something is fishy about the instruction set encoding here. Is the address shifted or is the LSB discarded?