[Simh] A few more possible bugs found
J. David Bryan
jdbryan at acm.org
Wed Mar 21 01:41:35 EDT 2012
On Tuesday, March 20, 2012 at 18:02, Michael Bloom wrote:
> 5) In pif_io(), in HP2100/hp2100_pif.c
> At the line
> setIRQ (select_code, !pif_control & pif_flag & pif_flagbuf);
> Is it really intended to use a boolean value with a bitwise operator?
To which boolean value are you referring? The three "pif" variables are
enums (compatible with int) with values of 0 or 1, the logical negation
produces an int, and ANDing produces an int, which is what is desired.
(The hardware modeled is a three-input AND gate with one input inverted.)
> (should ~ have been used instead of !
! produces 0 or 1, which matches one of the enum values. ~ produces a
value that is not one of the enum values.
In practice, though, only the LSB matters for setIRQ(), so they'd be
effectively equivalent.
> or perhaps parenthesis added to make it clearer?)
I'm not sure I see where you'd add the parentheses. Around !pif_control?
-- Dave
More information about the Simh
mailing list