+2001-07-11 Frank Ch. Eigler <fche@redhat.com>
+
+ * sid-cpu.scm (-gen-mach-params): New proc to emit ...CHUNK_BITSIZE...
+ (cgen-desc.h): Call it.
+ * sid-decode.scm (-gen-decode-fn): Use base-insn-bitsize as
+ decode-size.
+ * utils-sim.scm (-gen-decode-insn-entry): For SID only, prepare
+ entire_insn for extraction, if it's shorter than base-insn-bitsize.
+
2001-07-11 Frank Ch. Eigler <fche@redhat.com>
* desc-cpu.scm (-gen-mach-table-defns): Emit fourth field: the
))
)
+
+; Emit a macro that specifies the word-bitsize for each machine.
+(define (-gen-mach-params)
+ (string-map (lambda (mach)
+ (string-append
+ "#define MACH_" (string-upcase (gen-sym mach)) "_INSN_CHUNK_BITSIZE "
+ (number->string (cpu-insn-chunk-bitsize (mach-cpu mach))) "\n"))
+ (current-mach-list))
+)
+
+
; Generate <cpu>-desc.h.
(define (cgen-desc.h)
-gen-attr-decls
-gen-insn-attr-decls
+ -gen-mach-params
"
} // end @arch@ namespace
; of the instruction.
; ??? Make this a parameter later but only if necessary.
- (let ((decode-bitsize (apply min (map insn-base-mask-length insn-list))))
+ (let ((decode-bitsize (state-base-insn-bitsize)))
; Compute INITIAL-BITNUMS if not supplied.
; 0 is passed for the start bit (it is independent of lsb0?)
(else
(string-append indent " case "
- (number->string (dtable-entry-index entry))
- " : itype = "
- (gen-cpu-insn-enum (current-cpu) insn)
- "; "
+ (number->string (dtable-entry-index entry)) " : "
+ "itype = " (gen-cpu-insn-enum (current-cpu) insn) ";"
+ ; Compensate for base-insn-size > current-insn-size by adjusting entire_insn.
+ ; Activate this logic only for sid simulators; they are consistent in
+ ; interpreting base-insn-bitsize this way.
+ (if (and (equal? APPLICATION 'SID-SIMULATOR)
+ (> (state-base-insn-bitsize) (insn-length insn)))
+ (string-append
+ " entire_insn = base_insn >> "
+ (number->string (- (state-base-insn-bitsize) (insn-length insn)))
+ ";")
+ "")
(if (with-scache?)
(if fn?
- (string-append "@prefix@_extract_" fmt-name " (this, current_cpu, pc, base_insn, entire_insn); goto done;\n")
- (string-append "goto extract_" fmt-name ";"))
+ (string-append " @prefix@_extract_" fmt-name " (this, current_cpu, pc, base_insn, entire_insn); goto done;\n")
+ (string-append "goto extract_" fmt-name ";\n"))
"goto done;\n")))))
)