[Libre-soc-bugs] [Bug 656] add v3.0B BCD instructions to simulator

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sat Jul 31 10:26:17 BST 2021


https://bugs.libre-soc.org/show_bug.cgi?id=656

--- Comment #15 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to dmitry.selyutin from comment #13)
> Ah, I misread part of your comment.
> 
> > "dc[16] <- [0]*16" will be trying to assign a 16-bit value into an implicit 17th bit of dc, which is only 1 bit wide.
> 
> Now it's clear. Thank you again!

the assignment operator is now being correctly used, however this is still
trying to assign 16 bits of zeros into one single bit (the 17th) of dc.

* one bit wide, 17th bit: dc[16]
* 16 bits wide (zeros)  : [0]*16
* 16 bits trying to be assigned into the 17th bit: dc[16] <- [0]*16

what you want is just

   dc <- [0] * 16

and the compiler is smart enough (note, only for very simple assignments
like this) to note the bit-width of the assignment and automatically create
a variable, dc, of width 16 bit.

you would have found this when writing the unit test which executed this
code.


diff --git a/openpower/isa/bcd.mdwn b/openpower/isa/bcd.mdwn
index 04753ed..63c42b2 100644
--- a/openpower/isa/bcd.mdwn
+++ b/openpower/isa/bcd.mdwn
@@ -33,7 +33,7 @@ XO-Form

 Pseudo-code:

-    dc[16] = [0]*16
+    dc[16] <- [0]*16
     do i = 0 to 15
         temp <- (0b0 || RA[4*i:63]) + (0b0 || RB[4*i:63])
         dc[i] <- temp[0]

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list