[libre-riscv-dev] [Bug 269] auto-conversion / parser of POWER ISA Spec v3.0B

bugzilla-daemon at libre-riscv.org bugzilla-daemon at libre-riscv.org
Fri Apr 3 21:34:11 BST 2020


http://bugs.libre-riscv.org/show_bug.cgi?id=269

--- Comment #11 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Michael Nolan from comment #10)
> (In reply to Luke Kenneth Casson Leighton from comment #9)
> > oh i know why.  forgot to add __bool__.  sorted.  working now.
> 
> Yeah the values look correct to me now.
> 
> 
> > when *not* using exec() but instead writing out the code-fragments to
> > an actual file, we need some pre- and post- functions which are called
> > before and after each function, that do the exact same thing.
> > 
> > several ways to do that:
> > 
> > 1) pass in a dictionary of variables that are
> > to be added to locals():
> 
> This seems a little odd to me, but I'd be ok with it.
> 
> > 2) make everything class-based (yuk) self.RA, self.RT, blah blah.
> >
> > this one i feel looks messy.
> 
> I don't have a problem with this one, as it seems easier to understand to me
> than locals() or dropping variables into a module
>  
> > 5) other
> 
> It'd make the generated code a little messier, but couldn't we do what
> power_pseudo.py is currently doing and pass in a dict as a second argument?

then use it as d['RA'] = xxx etc.

i know from experience when working for Pine Digital (we did surpriiise
a python compiler) that dictionary accesses are a *lot* slower than attribute
accesses.

> This seems similar to option 2 in both pros and cons, in that the generated
> code isn't as nice looking but it's a bit easier to understand


*dinggg* lightbulb.  decorators.

https://realpython.com/primer-on-python-decorators/#decorating-functions-with-arguments

i always tend to get confused with decorators so will write a quick test.

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


More information about the libre-riscv-dev mailing list