[OpenPOWER-HDL-Cores] V3.0B ambiguity / inconvenience in pseudo-code EXTS() definition (plus missing definitions)
Jacob Lifshay
programmerjake at gmail.com
Sun Apr 5 04:05:45 UTC 2020
On Sat, Apr 4, 2020, 07:16 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
wrote:
> continuing with the implementation of a simulator that is taken
> directly - and literally - from the pseudocode and definitions of
> functions in the spec, we have hit an "inconvenient" definition.
> EXTS, section 1.3.4, page 6:
>
> EXTS(x) Result of extending x on the left with sign
> bits
>
> the problem is illustrated by asking the very simple question, "how many
> bits?"
Maybe it would work to treat it as a conversion from a bitstring to a
mathematical integer (like a Python3 int) where it can then be converted
back to a bitstring when it is assigned to something with a size again?
You don't need an infinite number of hardware bits to represent the
mathematical integer, since you know the exact range the values fall in so
you can calculate exactly how many bits you need, sign/zero-extending as
needed when converting back to a bitstring.
Jacob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mailinglist.openpowerfoundation.org/pipermail/openpower-hdl-cores/attachments/20200404/38b85cbb/attachment.html>
More information about the OpenPOWER-HDL-Cores
mailing list