* decoder bug fix
@ 2003-01-09 3:07 Ben Elliston
2003-01-09 3:45 ` Doug Evans
0 siblings, 1 reply; 3+ messages in thread
From: Ben Elliston @ 2003-01-09 3:07 UTC (permalink / raw)
To: cgen
I am committing the following patch (written by Graydon Hoare last
year) that fixes an edge condition in the (-gen-decoder-switch) logic.
Ben
2003-01-09 Ben Elliston <bje@redhat.com>
From Graydon Hoare <graydon@redhat.com>:
* utils-sim.scm (-gen-decoder-switch): Fix edge condition
empty ISAs.
Index: utils-sim.scm
===================================================================
RCS file: /cvs/src/src/cgen/utils-sim.scm,v
retrieving revision 1.8
diff -u -p -r1.8 utils-sim.scm
--- utils-sim.scm 20 Dec 2002 07:58:32 -0000 1.8
+++ utils-sim.scm 9 Jan 2003 03:05:01 -0000
@@ -938,9 +938,11 @@
";\n"
indent " val = "))
(string-append indent " unsigned int val = "))
- (-gen-decode-bits (dtable-guts-bitnums table-guts)
- (dtable-guts-startbit table-guts)
- (dtable-guts-bitsize table-guts) "insn" lsb0?)
+ (if (< (length (dtable-guts-bitnums table-guts)) 1)
+ "0"
+ (-gen-decode-bits (dtable-guts-bitnums table-guts)
+ (dtable-guts-startbit table-guts)
+ (dtable-guts-bitsize table-guts) "insn" lsb0?))
";\n"
indent " switch (val)\n"
indent " {\n"
<
^ permalink raw reply [flat|nested] 3+ messages in thread
* decoder bug fix
2003-01-09 3:07 decoder bug fix Ben Elliston
@ 2003-01-09 3:45 ` Doug Evans
2003-01-09 4:02 ` Ben Elliston
0 siblings, 1 reply; 3+ messages in thread
From: Doug Evans @ 2003-01-09 3:45 UTC (permalink / raw)
To: Ben Elliston; +Cc: cgen
Ben Elliston writes:
> I am committing the following patch (written by Graydon Hoare last
> year) that fixes an edge condition in the (-gen-decoder-switch) logic.
>
> Ben
>
> 2003-01-09 Ben Elliston <bje@redhat.com>
>
> From Graydon Hoare <graydon@redhat.com>:
> * utils-sim.scm (-gen-decoder-switch): Fix edge condition
> empty ISAs.
>
> Index: utils-sim.scm
> ===================================================================
> RCS file: /cvs/src/src/cgen/utils-sim.scm,v
> retrieving revision 1.8
> diff -u -p -r1.8 utils-sim.scm
> --- utils-sim.scm 20 Dec 2002 07:58:32 -0000 1.8
> +++ utils-sim.scm 9 Jan 2003 03:05:01 -0000
> @@ -938,9 +938,11 @@
> ";\n"
> indent " val = "))
> (string-append indent " unsigned int val = "))
> - (-gen-decode-bits (dtable-guts-bitnums table-guts)
> - (dtable-guts-startbit table-guts)
> - (dtable-guts-bitsize table-guts) "insn" lsb0?)
> + (if (< (length (dtable-guts-bitnums table-guts)) 1)
> + "0"
> + (-gen-decode-bits (dtable-guts-bitnums table-guts)
> + (dtable-guts-startbit table-guts)
> + (dtable-guts-bitsize table-guts) "insn" lsb0?))
> ";\n"
> indent " switch (val)\n"
> indent " {\n"
> <
This is ok with me,
though I can make an argument to fix -gen-decode-bits instead.
Without having tried it, seems like this should work.
--- utils-sim.scm.~1~ Sun Dec 22 14:57:08 2002
+++ utils-sim.scm Wed Jan 8 19:41:41 2003
@@ -550,8 +550,7 @@
pos (+ 1 count)
(cdr bitnums)))))))
(string-append
- "("
- (string-drop 3
+ "(0"
(string-map
(lambda (group)
(let* ((first (car group))
@@ -569,7 +568,7 @@
") & ("
(number->string (- (integer-expt 2 bits) 1))
" << " (number->string pos) "))")))
- groups))
+ groups)
")"))
)
[suitably re-indented of course]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: decoder bug fix
2003-01-09 3:45 ` Doug Evans
@ 2003-01-09 4:02 ` Ben Elliston
0 siblings, 0 replies; 3+ messages in thread
From: Ben Elliston @ 2003-01-09 4:02 UTC (permalink / raw)
To: Doug Evans; +Cc: cgen
>>>>> "Doug" == Doug Evans <dje@transmeta.com> writes:
Doug> This is ok with me, though I can make an argument to fix
Doug> -gen-decode-bits instead. Without having tried it, seems like
Doug> this should work.
The patch is in, so feel free to improve on it if you wish.
Ben
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-09 4:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-09 3:07 decoder bug fix Ben Elliston
2003-01-09 3:45 ` Doug Evans
2003-01-09 4:02 ` Ben Elliston
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).