OpenCores
Issue List
l.maci does not work #107
Closed jeremybennett opened this issue almost 14 years ago
jeremybennett commented almost 14 years ago
<p> The <tt>l.maci</tt> instruction does not appear to work in OR1200v2. No results are stored in MACHI and MACLO SPRs. </p> <p> The following code fragment demonstrates this. </p> <pre> /* Jeremy stuff. A l.maci which should not overflow */ l.movhi r4,hi(0x00000002) l.ori r4,r4,lo(0x00000002)
l.mtspr	r0,r0,SPR_MACHI
l.mtspr	r0,r0,SPR_MACLO

l.maci	r4,0x0002

l.mfspr	r3,r0,SPR_MACHI
l.jal	_report
l.nop
l.mfspr	r3,r0,SPR_MACLO
l.jal	_report
l.nop

/* Jeremy stuff. A l.maci which should overflow and be truncated. */
l.movhi	r4,hi(0x7fffffff)
l.ori	r4,r4,lo(0x7fffffff)

l.mtspr	r0,r0,SPR_MACHI
l.mtspr	r0,r0,SPR_MACLO

l.maci	r4,0x7fff

l.mfspr	r3,r0,SPR_MACHI
l.jal	_report
l.nop
l.mfspr	r3,r0,SPR_MACLO
l.jal	_report
l.nop
</pre> <p> The output shows that in both cases, no values have been stored. </p> <pre> 57560.00 ns: report (0) 59320.00 ns: report (0) 61680.00 ns: report (0) 63440.00 ns: report (0) </pre>
julius was assigned almost 14 years ago
julius commented over 13 years ago

The basics appear to work now. I get this:

3910.00 ns: l.nop report (00000000) 4210.00 ns: l.nop report (00000004) 5010.00 ns: l.nop report (000003ff) 5310.00 ns: l.nop report (7ffff801)

The first 2 reports look good, the second 2, not so.

I take it the second should be 0x7fffffff x 0x7fff + 0. We get reported 0x000003ff7ffff801, but my calculator says the result should be 0x00003fff7fff8001.

Still an accuracy bug here...

julius commented over 13 years ago

On reviewing bug 1787 (http://opencores.org/bug,view,1787) I believe the accuracy issue is to do with the immediate missing 4 bits.

In the VCD dump I can see the two multiply operands going to the MAC unit are 0x7fffffff and 0x7ff.

In light of this, the result of 0x3FF7FFFF801 is correct.

So I think I will mark this bug as closed, and we should focus on bug 1787 instead.

julius closed this over 13 years ago

Assignee
julius
Labels
Bug