[Libre-soc-bugs] [Bug 865] implement vector bitmanip opcodes

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Fri Jun 24 23:12:32 BST 2022


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

--- Comment #20 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Jacob Lifshay from comment #19)
> (In reply to Luke Kenneth Casson Leighton from comment #5)
> > +def bmask(mode, RA, RB=None, zero=False):
> > +    RT = RA if RB is not None and not zero else 0
> > +    mask = RB if RB is not None else 0xffffffffffffffff
> > +    a1 = RA if mode&1 else ~RA
> > +    mode2 = (mode >> 1) & 0b11
> > +    if mode2 == 0:
> > +        a2 = -RA
> > +    if mode2 == 1:
> > +        a2 = RA-1
> > +    if mode2 == 2:
> > +        a2 = RA+1
> 
> this is redundant since RA + 1 == -(~RA)
> 
> > +    if mode2 == 3:
> > +        a2 = ~(RA+1)
> 
> this is redundant since ~(RA + 1) = (~RA) - 1
> 
> removing both of those saves 1 more bit, making it 6 bits with all of my
> proposed additions.

thinking about a bit more, imho the mode2 options should be `RA - 1` and `RA +
1` since that saves gates, not requiring xor gates on the output of the add.

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


More information about the libre-soc-bugs mailing list