[Libre-soc-bugs] [Bug 671] convert spec pseudocode to use XLEN width
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Mon Aug 30 22:54:40 BST 2021
https://bugs.libre-soc.org/show_bug.cgi?id=671
--- Comment #50 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to dmitry.selyutin from comment #49)
> (In reply to Luke Kenneth Casson Leighton from comment #40)
> > but, actually, i think even that would work.
>
> This seems to do the trick:
>
> do i = 0 to 1
> n <- 0
> do j = 0 to ((XLEN/2)-1)
> if (RS)[(i*(XLEN/2))+j] = 1 then
> n <- n+1
> RA[(i*(XLEN/2)):(i*(XLEN/2))+((XLEN/2)-1)] <- n
>
> ...the last line looks particularly impressive.
much joy. let's write a spec that wins an obfuscation contest,
double bonus points.
much as i am tempted by that possibility,
can i suggest, a temp var or two:
e = XLEN/2-1
do i = 0 to 1
s = i*XLEN/2
n <- 0
do j = 0 to e
if (RS)[s+j] = 1 then
n <- n+1
RA[s:s+e] <- n
or other mercifully short temp var names
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list