This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
Re: cgen->sim question
Dave Korn wrote:
Dmitry Eremin-Solenikov wrote:
Hello,
I have a question regarding generating sim code from cgen description.
I have an instruction operand instantiated from field with type h-addr.
If in the semantics part of the instruction I try to access the operandr
as an address: '(mem QI ddaddr)', I get an error from cgen:
simplify.inc:131:3: op:new-mode: invalid mode for operand `ddaddr': USI
This is the definition of ddaddr:
(dif f-dd-1 "1-byte direct address at 1 position" (ABS-ADDR) 8 8 0 8 UINT #f #f)
(dno ddaddr "direct address" () h-addr f-dd-1)
I've seen this too. I made it go away by changing the hardware element type
in the define-normal-operand from h-addr to h-uint (or h-sint in some cases).
I don't know for a fact if it was the right thing to do, but all the
generated code ended up looking sane; it does leave me a little unsure,
however, because now I don't know what h-addr is actually supposed to be used
for - my port ends up not using it at all anywhere, and everything appears to
work.
Huh. I tried it and it worked ok.
(dni dmitry-test "dmitry's h-addr issue"
()
"dmitry $ddaddr"
(+ OP1_7 OP1_1 ddaddr)
(set (mem QI ddaddr) 0)
()
)
The generated code for a basic simulator has:
i_ddaddr = f_dd_1;
{
QI opval = 0;
SETMEMQI (current_cpu, pc, i_ddaddr, opval);
TRACE_RESULT (current_cpu, abuf, "memory", 'x', opval);
}
What does the instruction definition look like?