[comp.lsi] meg fix

frazier@oahu.cs.ucla.edu (11/17/88)

Hello, Folks.
	I have cured the problem I posted about earlier.
Meg was generating endot code which our version of endot
could not handle.  Specifically, it was generating code
of the form
	if in1 _ in2 _ in3 _ in4 and 1 _ 0 _ 0 _ 1 eql 0 _ 0 _ 0 _ 1 (
where underscore (_) is a macro for concat.  The above code concats the
inputs in question, masks them with a bit string and then compares them
to another bit string.  Endot has two problems with this.  First, the
eql was taking precidence over the and, and both the eql and the and were
(I think) taking precidence over the concat.  So I added parentheses.
The second problem was that the comparison was not working.  I believe
this had something to do with endot acting funny with leading 1's, but
anyway, the problem goes away when leading 0's are added, so I added
zero extensions to the code.  Now the above string looks like
	if ((in1 _ in2 _ in3 _ in4 ext 5) and (1 _ 0 _ 0 _ 1 ext 5)) eql
		(0 _ 0 _ 0 _ 1 ext 5) (
I have included here a diff between the original endot and my altered
version.  Please let me know if there is a problem with this code - I
am using it, after all!

88c88,94
<     int NoStates, i, FieldWidth;
---
>     int NoStates, i, FieldWidth,
>     /*
>       The variable NoInputs added by Greg Frazier (11/16/88) in
>       order to 0-extend the concatenated bits, which endot was
>       having problems with...
>       */
>     NoInputs;
130a137,141
> /*
>   change: added counting the number of inputs here for zero extension:
>   Greg Frazier 11/16/88
> */
>     NoInputs = 0;
132c143,144
<                      bit != (struct IdList *) 0; bit = bit->next )
---
>                      bit != (struct IdList *) 0; bit = bit->next ) {
>          NoInputs++;
133a146
>        }
245c258,262
<            printf( "if %s\n\t\tand ", v->name );
---
> /* The parentheses and zero-extension added by Greg Frazier
>    (11/16/88) because endot could not handle the grouping
>    or the comparison w/out the zero-extension
> */
>            printf( "if ((%s ext %d)\n\t\tand (", v->name, NoInputs+1 );
251c268
<            printf( "eql " );
---
>            printf( "ext %d)) eql\n\t\t\t(", NoInputs+1 );
258c275
<         printf( " (\n" );
---
>         printf( " ext %d)(\n", NoInputs+1 );


Greg Frazier
--------------------------------------------------------------------
Greg Frazier	    o	Internet: frazier@CS.UCLA.EDU
CS dept., UCLA	   /\	UUCP: ...!{ucbvax,rutgers}!ucla-cs!frazier
	       ----^/----
		   /