From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14722 invoked by alias); 9 Jan 2003 03:45:19 -0000 Mailing-List: contact cgen-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sources.redhat.com Received: (qmail 14702 invoked from network); 9 Jan 2003 03:45:18 -0000 Received: from unknown (HELO neon-gw.transmeta.com) (63.209.4.196) by 209.249.29.67 with SMTP; 9 Jan 2003 03:45:18 -0000 Received: (from root@localhost) by neon-gw.transmeta.com (8.9.3/8.9.3) id TAA17359; Wed, 8 Jan 2003 19:45:01 -0800 Received: from mailhost.transmeta.com(10.1.1.15) by neon-gw.transmeta.com via smap (V2.1) id xma017338; Wed, 8 Jan 03 19:44:44 -0800 Received: from casey.transmeta.com (casey.transmeta.com [10.10.25.22]) by deepthought.transmeta.com (8.11.6/8.11.6) with ESMTP id h093in306970; Wed, 8 Jan 2003 19:44:49 -0800 (PST) Received: (from dje@localhost) by casey.transmeta.com (8.9.3/8.7.3) id TAA13187; Wed, 8 Jan 2003 19:44:49 -0800 From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15900.61489.570002.368127@casey.transmeta.com> Date: Thu, 09 Jan 2003 03:45:00 -0000 To: Ben Elliston Cc: cgen@sources.redhat.com Subject: decoder bug fix In-Reply-To: References: X-SW-Source: 2003-q1/txt/msg00006.txt.bz2 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 > > From Graydon Hoare : > * 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]