[libre-riscv-dev] query in soc/TLB

Luke Kenneth Casson Leighton lkcl at lkcl.net
Fri Apr 12 13:56:42 BST 2019


On Fri, Apr 12, 2019 at 1:43 PM Rishabh Jain <rishucoding at gmail.com> wrote:
>
> hi everyone,

 hi rishabh

> Daniel,luke: could you please look into these:
> for file soc/TLB/src/AddressEncoder.py
> 1. is this table for priority encoder correct?
>
> I3   I2   I1   I0 | O1  O0  V
> 0    0    0    0  |  x    x    0
> x    x    x    1  |  0    0    1
> x    x    1    0  |  0    1    1
> x    1    0    0  |  1    0    1
> 1    0    0    0  |  1    1    1
>
> i believe this table follows with line 87 and 96 of
> soc/TLB/test/test_address_encoder.py.
> though Jacob answered this previously, but his table was giving priority to
> the highest bit.

 you need to read the docstring at the top of the class, in nmigen/lib/coding.py

 class PriorityEncoder:
    """Priority encode requests to binary.

    If any bit in ``i`` is asserted, ``n`` is low and ``o`` indicates
the least significant
    asserted bit.
    Otherwise, ``n`` is high and ``o`` is ``0``.
""""

note it says **LEAST** significant bit.  you have l3 l2 l1 l0 so the
LEAST significant bit is on the RIGHT.

so... L3=1 and l2/l1/l0=0.... therefore O=0b11... yes, i'd agree with that.

> 3. how do i go about understanding the module priority encoder and encoder.
> i really like nmigen having these built-in combinational ckts.. but to know
> what member variables are present and how the module is working, where to
> look?

 at the source code for the module, and for examples where it is used.

> I am struggling with values "encoder.n" and "p_encoder.n" .. i guess these
> are related to "valid input".

again: read the docstring.  it says "n is LOW" if any bit is asserted.

n is **LOW** if any bit is asserted.

> 4. I guess there is silly mistake on line 56 of AddressEncoder.py:
> should be : "Line56:  "# Multiple Match if encoder n is valid" "

 see above.  n is **LOW** if any bit is asserted.

> By Tuesday, I will be able to check other modules in TLB.
> I appreciate the efforts put by Daniel in commenting on the code. Really
> good comments.

 yeah, they are.



More information about the libre-riscv-dev mailing list