On Fri, May 4, 2012 at 6:56 PM, R. Diez <[email protected]> wrote: > Hi all: > > I have this source line in my modified or1200 test suite: > > // Subtract a large negative from a large positive number. Should set > // both the overflow and carry flags. > TEST_INST_FF_I32_I32 0, SPR_SR_CY | SPR_SR_OV, l.sub, 0x7fffffff, > 0x80000000 > > which translates into the following pseudo-instructions: > > set carry flag > set overflow flag > l.sub 0x7fffffff, 0x80000000 > > When run against or1ksim, it generates the following results: > > 0xffffffff, carry flag set, overflow flag set > > However, it looks different when run against ORPSoC V2's or1200 RTL model > (simulated with Icarus Verilog): > > 0xffffffff, carry flag set, _NO_ overflow flag > > I'm having similar issues with the multiply instructions, many carry and > overflow flags are different. I wonder if I've made a mistake somewhere. Or > are we really so lucky that nobody has ever noticed?
No, this could potentially be a genuine problem. The subtract test is far from exhaustive, and no doubt there's some holes there. I haven't investigated this one, but I suspect there's some overflow detection logic going awry (converting signed 0x80000000 into positive for the addition doesn't work correctly I suspect. I'll look into this though. What other suspect overflow results have you seen? Thanks Julius _______________________________________________ OpenRISC mailing list [email protected] http://lists.openrisc.net/listinfo/openrisc
