From 82662e2888139ec17d1617dca788b05dc697452f Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Fri, 24 Nov 2000 04:25:32 +0000 Subject: [PATCH] 2000-11-24 Ben Elliston * sim-cpu.scm (-gen-hardware-struct): New function. (-gen-hardware-types): If with-multiple-isa is specified, emit all hardware elements wich have share one or more ISAs with the ISAs being kept. --- ChangeLog | 5 +++++ sim-cpu.scm | 35 ++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4084c52..3e6b4fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2000-11-24 Ben Elliston + * sim-cpu.scm (-gen-hardware-struct): New function. + (-gen-hardware-types): If with-multiple-isa is specified, emit all + hardware elements wich have share one or more ISAs with the ISAs + being kept. + * sim.scm (-with-multiple-isa?): New symbol. (with-multiple-isa?): New function. (option-init!): Initialise -with-multiple-isa?. diff --git a/sim-cpu.scm b/sim-cpu.scm index 3399f17..b3b744f 100644 --- a/sim-cpu.scm +++ b/sim-cpu.scm @@ -40,6 +40,23 @@ (and (register? hw) (not (obj-has-attr? hw 'VIRTUAL))) ) +; Subroutine of -gen-hardware-types to generate the struct containing +; hardware elements of one isa. + +(define (-gen-hardware-struct hw-list) + (if (null? hw-list) + ; If struct is empty, leave it out to simplify generated code. + "" + (string-list-map (lambda (hw) + (string-list + (gen-decl hw) + (gen-obj-sanitize hw + (string-list + (send hw 'gen-get-macro) + (send hw 'gen-set-macro))))) + (find hw-need-storage? hw-list))) + ) + ; Return C type declarations of all of the hardware elements. ; The name of the type is prepended with the cpu family name. @@ -49,15 +66,15 @@ "typedef struct {\n" " /* Hardware elements. */\n" " struct {\n" - (string-list-map (lambda (hw) - (string-list - (gen-decl hw) - (gen-obj-sanitize hw - (string-list - (send hw 'gen-get-macro) - (send hw 'gen-set-macro))) - )) - (find hw-need-storage? (current-hw-list))) + (-gen-hardware-struct + (find (lambda (hw) + (or (not (with-multiple-isa?)) + (>= (count-common + (current-keep-isa-name-list) + (bitset-attr->list (obj-attr-value hw 'ISA))) + 1))) + (current-hw-list)) + ) " } hardware;\n" "#define CPU_CGEN_HW(cpu) (& (cpu)->cpu_data.hardware)\n" ;" /* CPU profiling state information. */\n" -- 2.43.5