[libre-riscv-dev] [Bug 64] data handling / io control / data routing API needed

bugzilla-daemon at libre-riscv.org bugzilla-daemon at libre-riscv.org
Tue Apr 30 03:42:09 BST 2019


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

--- Comment #39 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #22)
> (In reply to Jacob Lifshay from comment #8)
> 
> > > * Data.eq not Data.assign is better, although just "eq" is preferred
> > >   (which can be used as "from import library import data" then
> > > "data.eq(...)")
> > I'm using Data as a place to stash lots of Data-related static functions. We
> > can switch to a module if you like.
> 
>  temporarily nmoperator.py (would like it to be e.g. nmutils.operator)
> 
>  http://bugs.libre-riscv.org/show_bug.cgi?id=68
> 
>  amazingly, only 3 or 4 actual functions are needed.  eq, shape and cat
>  are three key functions:
> 
>  * eq is obvious [at least, if nmigen's eq is understood, it's obvious]
> 
>  * shape and cat are needed in order to flatten data down and back out
>    to and from a straight signal.
> 
>  shape and cat get used inside the FIFOControl object (which in turn
>  uses that excellent Queue module that you wrote).
I don't think we should use nmigen's FIFO interface, having an interface like
was in the original Chisel code with a separate enq (entry) and deq (exit) port
means that Queue is a Block rather than changing Queue to fit nmigen's FIFO
interface only to then need to adapt back to the 2-port interface everywhere.

> 
>  shape() is used to find out, from the *recursively-iterable*
>  thing-of-Value-derivatives, what size of Signal() would be needed to store
> it
>  (as a sequence of bits)
I think we should call it bitlen or something like that, to me shape implies
returning the type of the Data rather than the number of bits inside it. In C++
it would be sizeof vs. decltype.
> 
>  cat() is used to flatten() and *de*-flatten() the incoming and outgoing
>  hierarchy-of-Value-derivatives so that ONLY ONE Queue object is needed.
I think we should do that inside the Queue implementation (or better yet,
inside Memory, which is what the original Chisel code does).
> 
>  without cat() and shape() it would be an awful mess-of-code, analysing
>  the data and recursively allocating (*and connecting up*) a massive suite
>  of Queue objects.
> 
>  this prospect was so dreadful that i added the two extra functions to the
>  data-handling API.
> 
>  if it wasn't for that, the data-handling API would *literally* be one
>  function:
> 
>  eq()!

We need at least one more function, create a new Data that shares the type of
an existing one. I did that using Shape.get(data).create_data(), similar to
python type(value)(). This is used to create Data instances for internal
registers and what-not.

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


More information about the libre-riscv-dev mailing list