Joern Rennecke wrote:
>When I want to put a constant into a multi-ifield, the
>exact instructions how to set the subfields are
apparently ignored, and the
>total value is copied into the subfields.
>
>
This does appear to be broken. This is probably the first
time someone
has attempted this, since you could use f-a and f-c
directly.
(dni
swi
""
"swi"
(+ (f-a 1) (f-b 3) (f-c 2) (f-d 4))
()
(sequence ()
(set pc (c-call SI "foo_trap" pc 0)))
)
Multi-ifields are generally used in conjuction with an
operand. I'm not
saying you shouldn't be able to do what you're attempting,
just that no
one has likely tried it before.
Dave
>I have found this while working on my machine
desscription,
>and I could reproduce this with a small synthetic
testcase, attached as
>foo.cpu. I've put tis file into the cgen/cpu directory,
and
>then with the cgen directory as the cwd, invoked guile
and evaluated:
>(load "dev.scm")
>(load-sim)
>(cload #:arch "foo" #:machs "foo")
>(cgen-decode.c)
>
>note that the expected value to check entire_insn
against is 0x1324,
>but generated test is:
> if ((entire_insn & 0xffff) == 0x12424)
>
>
>--------------------------------------------------------
----------------
>
>(include "simplify.inc")
>
>(define-arch
> (name foo) ; name of cpu family
> (comment "")
> (default-alignment aligned)
> (insn-lsb0? #f)
> (machs foo)
> (isas foo)
>)
>
>(define-isa
> (name foo)
>
> ; The default size of an instruction in bits
> (default-insn-bitsize 16)
>
> (base-insn-bitsize 16)
>
> (default-insn-word-bitsize 16)
>)
>
>(define-cpu
> (name foo)
> (comment "")
> (endian either)
> (word-bitsize 16)
> ; Generated files have an "f" suffix.
> (file-transform "f")
>)
>
>(define-mach
> (name foo)
> (comment "")
> (cpu foo)
>)
>
>(dnf f-a "op a" () 0 4)
>(dnf f-b "op a" () 4 4)
>(dnf f-c "op a" () 8 4)
>(dnf f-d "op a" () 12 4)
>(dnmf f-ac "op ac" () UINT
> (f-a f-c)
> (sequence () ; insert
> (set (ifield f-c) (and (ifield f-ac) (const 15)))
> (set (ifield f-a) (srl (ifield f-ac) (const 4)))
> )
> (sequence () ; extract
> (set (ifield f-ac) (or (ifield f-c) (sll (ifield
f-a) 4)))
> )
>)
>
>(define-pmacro (dni xname xcomment xsyntax xformat
xattrs xsemantics)
> (define-insn
> (name xname)
> (comment xcomment)
> (.splice attrs (.unsplice xattrs))
> (syntax xsyntax)
> (format xformat)
> (semantics xsemantics)
> )
>)
>
>(dnh h-pc "program counter" (PC PROFILE) (pc)
() () ())
>
>(dni
> swi
> ""
> "swi"
> (+ (f-ac 18) (f-b 3) (f-d 4))
> ()
> (sequence ()
> (set pc (c-call SI "foo_trap" pc 0)))
>)
>
>
>
|