[Libre-soc-bugs] [Bug 656] add v3.0B BCD instructions to simulator
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Wed Jul 28 11:20:46 BST 2021
https://bugs.libre-soc.org/show_bug.cgi?id=656
--- Comment #1 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
dmitry the pseudocode for cdtbcd and cbcdtd uses a couple of helper functions
which need to be added before they can "work". addg6s on the other hand
you can do straight away without this.
i found in "v3.0B p787 Book I Appendix B.1 and B.2" the following
pseudocode:
B.1 BCD-to-DPD Translation
The translation from a 3-digit BCD number to a 10-bit
DPD can be performed through the following Boolean
operations.
p = (f & a & i & ¬e) | (j & a & ¬i) | (b & ¬a)
q = (g & a & i & ¬e) | (k & a & ¬i) | (c & ¬a)
r = d
s = (j & ¬a & e & ¬i) | (f & ¬i & ¬e) |
(f & ¬a & ¬e) | (e & i)
t = (k & ¬a & e & ¬i) | (g & ¬i & ¬e) |
(g & ¬a & ¬e) | (a & i)
u = h
v = a | e | i
w = (¬e & j & ¬i) | (e & i) | a
x = (¬a & k & ¬i) | (a & i) | e
y = m
B.2 DPD-to-BCD Translation
The translation from a 10-bit DPD to a 3-digit BCD
number can be performed through the following Bool-
ean operations.
a = (¬s & v & w) | (t & v & w & s) | (v & w & ¬x)
b = (p & s & x & ¬t) | (p & ¬w) | (p & ¬v)
c = (q & s & x & ¬t) | (q & ¬w) | (q & ¬v)
d = r
e = (v & ¬w & x) | (s & v & w & x) |
(¬t & v & x & w)
f = (p & t & v & w & x & ¬s) | (s & ¬x & v) |
(s & ¬v)
g = (q & t & w & v & x & ¬s) | (t & ¬x & v) |
(t & ¬v)
h = u
i = (t & v & w & x) | (s & v & w & x) |
(v & ¬w & ¬x)
j = (p & ¬s & ¬t & w & v) | (s & v & ¬w & x) |
(p & w & ¬x & v) | (w & ¬v)
k = (q & ¬s & ¬t & v & w) | (t & v & ¬w & x) |
(q & v & w & ¬x) | (x & ¬v)
m = y
after removing the silliness of *yet another* non-ASCII symbol for "¬"
being used, those will need to go into openpower/isafunctions/bcd.mdwn,
along with comments saying where they come from. see here for example
to cut/paste:
https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=openpower/isafunctions/fpfromint.mdwn;hb=HEAD
then you can run "pyfnwriter" to generate the actual python code
then, in pywriter.py you will need to *add* those helper functions
*manually* (at the moment, really they should be done automatically)
https://git.libre-soc.org/?p=openpower-isa.git;a=blob;f=src/openpower/decoder/pseudo/pywriter.py;hb=HEAD
at line 33, add
from openpower.decoder.isafunctions.bcd import BCD_TO_DPD, DPD_TO_BCD
then re-run pywriter noall bcd in order to get the decoder/isa/bcd.py
to be re-compiled with the import of the helper function added.
or, cheat, and manually edit decoder/isa/bcd.py :)
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list