Libre RISC-V Mailing list Archives (accessible via public-inbox)
 help / color / Atom feed
* [libre-riscv-dev] [Bug 276] SR NAND Latch needed in nmigen
From: bugzilla-daemon @ 2020-04-03 12:05 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-276-13@http.bugs.libre-riscv.org/>

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

--- Comment #2 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to whitequark from comment #1)
> (The following comment is copied from the email I sent earlier, so that it
> is accessible publicly.)

appreciated, whitequark.

summary (the rest is archive-suitable / context) is: we'd like to be able
to do "exact" netlist (we already have semi-equivalent, and this is working).


> Of the things you mentioned, this includes only the SR latch issue.
> 
> This issue is unfortunately quite involved. (n)Migen is designed to
> connect large islands of purely synchronous logic with a few async
> bridges. It does not, very deliberately, directly support arbitrary
> asynchronous primitives like the SR latch. So you can't just drop one
> into your design and have it work the same way normal logic works.

yes.  very much aware that standard proprietary commercial tools completely
dropped support for SR latches.

(reiterating this for the archives:
however we really cannot use DFFs, here.  that is 10 gates rather than 2,
and the number of Cells needed is massive: one of the Matrices may need
to be 128 x 30, with at least four maybe five latches per Cell.  that's
192,000 gates *just for that Matrix* if we use DFFs.
if we use SR Latches, it's 38400 gates, which is tolerable)


> However, you're in luck because better support for asynchronous
> signals was something I took into account when designing nMigen and
> both of the new simulators, pysim and cxxsim.

whew :)

> To solve this issue, we'll need to work together to determine your
> specific use case. Do you want to use the exact same netlist for
> nMigen simulation and synthesis?

i honestly don't know: we're open to suggestions.  (having read ahead)
if we can do both (and use one for rapid prototyping and the other as
a cross-check before moving to synthethis) that would be great.

right now we have something that "works" however
it uses DFFs, not SR latches (see latch.py link, below).

> If not, it means you can model
> whatever it is that contains the SR latches (I'm not sure what
> matrices you're referring to, here)

Out-of-Order Read/Write Hazard detection and avoidance matrices.
see "Modifications to Dependency Cell"
https://libre-riscv.org/3d_gpu/architecture/6600scoreboard/

* the DMs encode all registers in Unary (single bit activation).
  thus one "row" represents all registers used for a given FunctionUnit
  [and access to its ALU].
* each Cell thus records, in bit-level (unary) form, the fact that read/write
  for a given function (add) is needed, by raising the "Reg 5 needs READ"
  and "Reg 7 needs WRITE" SR Latches
* these now-active signals indicate to subsequent instructions
  "hello i have a read hazard, hello i have a write hazard" respectively.
  attempts to use those registers thus STOPs that FunctionUnit from executing.
* hazards get cleared out once results are written
* when there are zero hazards (in any given row), that instruction
  becomes free-and-clear to proceed.

it's actually incredibly simple.

here's one for Register-to-FunctionUnit (FU being the "arbitrator" for access
to an ALU pipeline), you have to drill down a bit (through DependencyRow)
to get to the SR Latches themselves

https://git.libre-riscv.org/?p=soc.git;a=blob;f=src/soc/scoreboard/fu_reg_matrix.py;h=06380434c8d7d20828d80c3d0e020161bcb2c2e4;hb=b01f6bc0ad28cda131beae33e5fe338daaf5e9ea

> using synchronous code, 

funnily enough that's where we are right now:
https://git.libre-riscv.org/?p=nmutil.git;a=blob;f=src/nmutil/latch.py;h=7d6a1efe22c881585a626e397590337186f6ef1b;hb=HEAD#l41

> and
> replace them with true SR latches for synthesis. Of course, you will
> need to convince yourself these two designs are equivalent.

yes.  fortunately, coriolis2 has gate-level simulation (which needs
investigation) so we can triple-check.


> If you *do* want to use the exact same netlist, there are a few
> options. Both the new nMigen simulator and cxxrtl use an architecture
> that, in principle, supports logic feedback loops. So you can model
> the SR latch using two ordinary NAND gates. If you have an instance
> of a SRNAND cell, you can provide a simulation model for this instance
> that uses two NAND gates, and it'll work. 

with the caveat that the current SRLatch class is actually a Reset-priority
SR latch, i *believe* we already have the former, so this latter is really
what we'd like to have.

we can always flip in/out the current SR Latch for a properly asynchronous
one (exact same netlist), run some (unbelievably slow) tests, then generate
the actual netlist to be handed to yosys (and from there to coriolis2).


> However, I must warn you
> that both for nMigen pysim and cxxrtl, this will come with a severe
> performance penalty of at least ~10x, possibly worse depending on your
> exact design. If you are planning to use fine SRNAND cells (one per
> bit rather than one per word), expect a further slowdown of the word
> size factor.

interesting, because a multi-word design turned out to be necessary
to get a speedup factor (some of the Matrices are so large - 128 x 30) that
we get seconds per clock in pysim if done as individual one-bit Cells.
the Matrices are so large - 128 x 30 will be the largest - that with a
4 to 5 level hierarchy of Elaboratable classes it was intolerable.

by removing one level of hierarchy, pysim ran in reasonable time.

i found this generally to be true: the more levels of hierarchy, the
slower pysim got.  and due to the MASSIVE size of our designs, we need
hierarchically-laid-out classes (well over 250 so far).


> Another issue is that neither pysim nor cxxsim provide
> any way to control the possible race conditions. That is, the SRNAND
> latch that is simulated in pysim or cxxsim will initialize to
> an indeterminate value, and chaining them together will lead to
> unpredictable results.

you'll like this: it's much "worse" than it looks :)  we actually have
a triple-connected ring of SRNAND latches, acting as a pseudo pipeline.

however, it turns out that the set-reset logic which *enables* the three
SRNANDs is very, very specifically organised such that only two of them
are ever possible to have active at any one time, and thus we create
a "revolving door" effect.

those "protections" are all synchronous.  so whilst the SRNAND cells
are asynchronous and could hypothetically end up in "unknown", in
practice this can *never* occur because the conditions which create
"unknown" are specifically avoided (and avoided using synchronous
logic).

in case you were wondering: this is a proven design.  it was used in the
original CDC 6600, and also in the AMD Opteron Series.  however, in the
CDC 6600 they used transistors (as in: *actual* three-pronged transistors,
the largest ever single order made for transistors in the world), and
in the AMD Opteron Series they of course had the financial budget and
resources of a multi-billion-dollar company and so could happily pay for
custom silicon.

so.  conclusion, after all that (apologies), is back at the top.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 276] SR NAND Latch needed in nmigen
From: bugzilla-daemon @ 2020-04-03 12:11 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-276-13@http.bugs.libre-riscv.org/>

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

--- Comment #3 from whitequark@whitequark.org ---
OK, having read that I suggest we follow the standard procedure. The new pysim
design should already handle this kind of logic loop just fine. I suggest you
make a (coarse) SRNAND latch out of normal (coarse) NAND cells, test that it
works correctly in your designs, and if it does not, file an MCVE over at the
nmigen repository. Then I investigate and fix any issues. The same with cxxsim
once it's ready.

Regarding hierarchical design slowdown: this is inevitable in the current pysim
architecture, but cxxsim can trivially use the Yosys flattening functionality
and does not suffer from any hierarchy-related issues.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 277] New: evaluate proposal of portions of nmutil for review and inclusion in nmigen
From: bugzilla-daemon @ 2020-04-03 12:12 UTC (permalink / raw)
  To: libre-riscv-dev

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

            Bug ID: 277
           Summary: evaluate proposal of portions of nmutil for review and
                    inclusion in nmigen
           Product: Libre-SOC's first SoC
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: CONFIRMED
          Severity: enhancement
          Priority: ---
         Component: Source Code
          Assignee: lkcl@lkcl.net
          Reporter: lkcl@lkcl.net
                CC: libre-riscv-dev@lists.libre-riscv.org
   NLnet milestone: ---

https://git.libre-riscv.org/?p=nmutil.git;a=blob;f=src/nmutil/picker.py;hb=HEAD
https://git.libre-riscv.org/?p=nmutil.git;a=blob;f=src/nmutil/queue.py;hb=HEAD

these are general-purpose utility functions that go beyond Libre-SOC.
having them in nmigen would be nice.  this will involve proper review.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 276] SR NAND Latch needed in nmigen
From: bugzilla-daemon @ 2020-04-03 12:52 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-276-13@http.bugs.libre-riscv.org/>

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

--- Comment #4 from whitequark@whitequark.org ---
Ah, there's another option that you might find interesting. Yosys has a `$sr`
coarse cell. If you're willing to forgo pysim completely and get cxxsim working
for you, then I could implement support for that cell in cxxsim. It would
probably be the least amount of work out of every discussed option, provided
that you can get cxxsim working for you.

Of course, you might want to look into cxxsim anyway given the massive
performance improvements it promises (on fully synchronous designs, it's
actually competitive with single-threaded Verilator generated code; on designs
with feedback arcs performance will degrade by the above-mentioned factor of
about 5-10x, but still quite fast.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 276] SR NAND Latch needed in nmigen
From: bugzilla-daemon @ 2020-04-03 13:24 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-276-13@http.bugs.libre-riscv.org/>

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

--- Comment #5 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to whitequark from comment #4)
> Ah, there's another option that you might find interesting. Yosys has a
> `$sr` coarse cell. 

yes.  this i _believe_ is what Staf has implemented for us, in the nsxlib
Cell Library:
http://bugs.libre-riscv.org/show_bug.cgi?id=154#c21

> If you're willing to forgo pysim completely and get
> cxxsim working for you, then I could implement support for that cell in
> cxxsim.

yes please.

> It would probably be the least amount of work out of every discussed
> option, provided that you can get cxxsim working for you.

ah then that's worthwhile investigating straight away.  are there examples
anywhere?

> Of course, you might want to look into cxxsim anyway

yes.  we've a half million gate design.  using e.g. cocotb (a python
co-simulator which compiles verilog using verilator and then annotates
and interacts with it from python) was on the cards.

out of interest would that be feasible using cxxsim (either as an addition
to cocotb or as a separate project)?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 276] SR NAND Latch needed in nmigen
From: bugzilla-daemon @ 2020-04-03 13:42 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-276-13@http.bugs.libre-riscv.org/>

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

--- Comment #6 from whitequark@whitequark.org ---
> yes.  this i _believe_ is what Staf has implemented for us, in the nsxlib Cell Library: http://bugs.libre-riscv.org/show_bug.cgi?id=154#c21

If your designs are already using $sr cells then the cxxsim approach would be
ideal.

> ah then that's worthwhile investigating straight away.  are there examples anywhere?

Yes, in the pull request introducing the backend (which is not yet merged, I'm
adding some polish to it right now):
https://github.com/YosysHQ/yosys/pull/1562. The examples are a bit sparse but I
think the developers working on this project will have no issues figuring
things out (or just ask me).

The general idea behind cxxsim is to be as straightforward translation of RTLIL
to C++ as possible. Of course, RTLIL is not imperative, so some extra logic is
necessary.

This extra logic isn't something I invented myself, but rather I took the
well-known VHDL two-phase simulator that provides deterministic* results
regardless of evaluation order, even for combinatorial loops, and adapted it to
RTLIL. Some VHDL developers call it "the crown jewel of VHDL" and I concur, it
is an excellent algorithm.

* The "deterministic" in reference to this simulator means that the results are
the same regardless of the order in which the (parallel) RTLIL is translated to
(sequential) C++, taking that one step out of consideration when debugging your
code. If your design is inherently racy, you will get nondeterministic results
anyway.

> using e.g. cocotb (a python co-simulator which compiles verilog using verilator and then annotates and interacts with it from python) was on the cards.
> out of interest would that be feasible using cxxsim (either as an addition
to cocotb or as a separate project)?

So, I'm working on two different patches, which are somewhat confusingly named
"cxxrtl" and "cxxsim".

Cxxrtl is an addition to Yosys that allows it to emit C++ simulating virtually
any valid RTLIL, similar to Verilator but more flexible. (Verilator doesn't
support asynchronous logic at all, cxxrtl does, at a fairly significant
performance penalty if you have any in your design.) Cxxrtl is largely
finished; it has been used for simulating medium-sized SoCs and I expect it
would not present any issues for your codebase as long as you stick to
synchronous logic only.

Cxxsim is an addition to nMigen that would do basically the same thing as
cocotb, but present an interface identical to the existing pure-Python
simulator. Cxxsim does not yet exist. It is however fairly high on my list of
things to do.

For now I suggest that you simulate your code using a C++ testbench to see what
sort of performance you get, and running simple acceptanace tests to see if
there are any glaring issues in cxxrtl that break your design. I think there is
no point writing code to integrate cxxrtl with cocotb; cxxsim is about as much
effort, and will let you use your exiting testcases unmodified.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 276] SR NAND Latch needed in nmigen
From: bugzilla-daemon @ 2020-04-03 13:58 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-276-13@http.bugs.libre-riscv.org/>

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

--- Comment #7 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to whitequark from comment #6)
> > yes.  this i _believe_ is what Staf has implemented for us, in the nsxlib Cell Library: http://bugs.libre-riscv.org/show_bug.cgi?id=154#c21
> 
> If your designs are already using $sr cells then the cxxsim approach would
> be ideal.

brilliant.  at a suitable time in the future we'd need a (quick) indicator
on how to express $sr in nmigen


> > ah then that's worthwhile investigating straight away.  are there examples anywhere?
> 
> Yes, in the pull request introducing the backend (which is not yet merged,
> I'm adding some polish to it right now):
> https://github.com/YosysHQ/yosys/pull/1562. The examples are a bit sparse
> but I think the developers working on this project will have no issues
> figuring things out

correct :)

> (or just ask me).
> 
> The general idea behind cxxsim is to be as straightforward translation of
> RTLIL to C++ as possible. Of course, RTLIL is not imperative, so some extra
> logic is necessary.
> 
> This extra logic isn't something I invented myself, but rather I took the
> well-known VHDL two-phase simulator that provides deterministic* results
> regardless of evaluation order, even for combinatorial loops, and adapted it
> to RTLIL. Some VHDL developers call it "the crown jewel of VHDL" and I
> concur, it is an excellent algorithm.

i heard rumour about this from elsewhere.

> > out of interest would that be feasible using cxxsim (either as an addition
> > to cocotb or as a separate project)?
> 
> So, I'm working on two different patches, which are somewhat confusingly
> named "cxxrtl" and "cxxsim".

:)

> For now I suggest that you simulate your code using a C++ testbench to see
> what sort of performance you get, and running simple acceptanace tests to
> see if there are any glaring issues in cxxrtl that break your design. 

willdo.

> I
> think there is no point writing code to integrate cxxrtl with cocotb; cxxsim
> is about as much effort, and will let you use your exiting testcases
> unmodified.

fantastic.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 276] SR NAND Latch needed in nmigen
From: bugzilla-daemon @ 2020-04-03 14:02 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-276-13@http.bugs.libre-riscv.org/>

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

--- Comment #8 from whitequark@whitequark.org ---
> brilliant.  at a suitable time in the future we'd need a (quick) indicator on how to express $sr in nmigen

assert width == len(set) and width == len(clr) and width == len(q)
m.submodules += Instance("$sr",
    p_WIDTH=width,
    p_SET_POLARITY=1,
    p_CLR_POLARITY=1,
    i_SET=set,
    i_CLR=clr,
    o_Q=q)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 275] errata in V3.0B spec pseudo-code, page 88
From: bugzilla-daemon @ 2020-04-03 14:52 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-275-13@http.bugs.libre-riscv.org/>

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

--- Comment #1 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
second one, in cmpi:

+++ b/openpower/isa/comparefixed.mdwn
@@ -89,7 +89,7 @@ X-Form
        in_range <-  (src22lo  <= src1) & (src1 <=  src22hi)
     else
        in_range <- ((src21lo  <= src1) & (src1 <=  src21hi)) |
-       in_range <- ((src22lo  <= src1) & (src1 <=  src22hi))
+                   ((src22lo  <= src1) & (src1 <=  src22hi))
     CR[4×BF+32] <- 0b0
     CR[4×BF+33] <- in_range
     CR[4×BF+34] <- 0b0

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] parser precedence, code review / checking needed
From: Luke Kenneth Casson Leighton @ 2020-04-03 15:19 UTC (permalink / raw)
  To: Libre-RISCV General Development

if anyone knows how to resolve operator precedence, my logic-dyslexia
is kicking in and i am having difficulty working out which operators
are supposed to be in which order, for bit-wise AND, OR, and
PLUS/MINUS, MUL/DIV.  someone else did the PLUS/MINUS MUL/DIV, i'm
attempting to add AND and OR and am getting it wrong

here's how python-ply is supposed to work:
http://www.dabeaz.com/ply/ply.html#ply_nn27

here's a patch showing the relevant files involved:
https://git.libre-riscv.org/?p=soc.git;a=commitdiff;h=39c8314f9a14fb5351a9dcbc8bd37753bdcd0fee

executing "python3 soc/decoder/power_pseudo.py" is a good test, with
this being good example code:
+cmpi = """
+in_range <-  (x | y) & (a | b)
+in_range <-  (x + y) - (a + b)
+"""

help appreciated.

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] submitted bugreport to upstream nmigen
From: Jacob Lifshay @ 2020-04-03 17:41 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <CAPweEDyFfZjD0qRO1qo-JBwnmG4R6FWJ+fOC5Q=an9LVg1_J3w@mail.gmail.com>

On Fri, Apr 3, 2020, 03:38 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
wrote:

> ---
> crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68
>
> On Fri, Apr 3, 2020 at 5:10 AM Jacob Lifshay <programmerjake@gmail.com>
> wrote:
> >
> > On Wed, Apr 1, 2020 at 8:03 PM Jacob Lifshay <programmerjake@gmail.com>
> wrote:
> > > Rerunning nmutil CI build to find the next errors:
> > > https://salsa.debian.org/Kazan-team/nmutil/-/jobs/642930
> >
> > Fixed the remaining issues with nmutil, ended up adding
> > @unittest.skip() to 3 tests.
> >
> > The CI build passes!
>
> exxcellent, that's really good news.
>
> > https://salsa.debian.org/Kazan-team/nmutil/-/jobs/644343
>
> *pauses*.... ah.  i didn't realise that salsa - an external resource
> not archived or under our direct control - had been selected for
> creating information (reports) that is critically important to
> preserve.
>

I didn't consider it critical information since it can theoretically be
automatically regenerated (assuming we wrote our build scripts properly).

>
> if we are kicked off of salsa or the service is terminated (debian
> loses their sponsorship from gitlab) all those reports could be lost.
>
> so we need to do three things:
>
> 1. work out how we managed to miss that, when it has been running for
> such a long time already.
>
> 2. work out how we are going to archive the logs createe by Cl
>

it may not be the best solution, but there is archive.org:
https://web.archive.org/web/20200403173646/https://salsa.debian.org/Kazan-team/nmutil/-/jobs/644343/raw

>
> 3. wotk out if there is a way to get backups off of salsa of whatever
> databases are being created .


Jacob
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 275] errata in V3.0B spec pseudo-code, page 88
From: bugzilla-daemon @ 2020-04-03 18:00 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-275-13@http.bugs.libre-riscv.org/>

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

Jacob Lifshay <programmerjake@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |programmerjake@gmail.com

--- Comment #2 from Jacob Lifshay <programmerjake@gmail.com> ---
maybe you should just grep for '\|[\n\t ]*[a-zA-Z0-9_]+ *<-' since that seems
like a common error.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] submitted bugreport to upstream nmigen
From: Luke Kenneth Casson Leighton @ 2020-04-03 18:11 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <CAC2bXD7efajP3wKU9xH6FTg5C9Vh4TVgPtc9=DadHAB9MeqNfQ@mail.gmail.com>

On Fri, Apr 3, 2020 at 6:41 PM Jacob Lifshay <programmerjake@gmail.com> wrote:

> I didn't consider it critical information since it can theoretically be
> automatically regenerated (assuming we wrote our build scripts properly).

mmm... technically... yes.  except a year later, if we want to
precisely reproduce that exact error (regression testing), and the
salsa server is no longer available, six months prior?

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 275] errata in V3.0B spec pseudo-code, page 88
From: bugzilla-daemon @ 2020-04-03 18:13 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-275-13@http.bugs.libre-riscv.org/>

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

--- Comment #3 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Jacob Lifshay from comment #2)
> maybe you should just grep for '\|[\n\t ]*[a-zA-Z0-9_]+ *<-' since that
> seems like a common error.

the two that the error occurs are in a different font.  from this we can
hypothesise that they were added at a later date by a different user of
the proprietary editor tool.

i am going systematically through all of the pseudo-code scripts, one by
one, finding and fixing errors.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] parser precedence, code review / checking needed
From: Jacob Lifshay @ 2020-04-03 18:22 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <CAPweEDygK1iT_u0Y9zVGNNX91Ndyd7FQM9hm+Yr3_KJnWuL+ig@mail.gmail.com>

On Fri, Apr 3, 2020, 08:20 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
wrote:

> if anyone knows how to resolve operator precedence, my logic-dyslexia
> is kicking in and i am having difficulty working out which operators
> are supposed to be in which order, for bit-wise AND, OR, and
> PLUS/MINUS, MUL/DIV.  someone else did the PLUS/MINUS MUL/DIV, i'm
> attempting to add AND and OR and am getting it wrong
>

The way I always did it is by changing the grammar to have one non-terminal
symbol per precedence level. Example code from my LR(1) parser generator:
https://github.com/programmerjake/parser-generator/blob/master/test.parser#L108-L120

If I were writing the parser I would have used either a hand-written
recursive descent parser (what I used for the shader-compiler-ir text
parser) or a PEG parser, since PEGs don't have ambiguity since they are
defined in terms of the steps taken when parsing instead of being defined
in terms of what strings the rules can produce (LL(1) and LR(1) parsers).

>
> here's how python-ply is supposed to work:
> http://www.dabeaz.com/ply/ply.html#ply_nn27
>
> here's a patch showing the relevant files involved:
>
> https://git.libre-riscv.org/?p=soc.git;a=commitdiff;h=39c8314f9a14fb5351a9dcbc8bd37753bdcd0fee
>
> executing "python3 soc/decoder/power_pseudo.py" is a good test, with
> this being good example code:
> +cmpi = """
> +in_range <-  (x | y) & (a | b)
> +in_range <-  (x + y) - (a + b)
> +"""
>

since there are parenthesis, precedence between &, |, +, and - doesn't
actually matter here, so it's not a good example. Traditionally + and -
have the same precedence whereas & has higher precedence than | so a & b |
c parses as (a & b) | c.


> help appreciated.
>

Sure, I can figure it out for you if you like. Will be a few minutes.

Jacob
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] submitted bugreport to upstream nmigen
From: Jacob Lifshay @ 2020-04-03 18:26 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <CAPweEDz3t5oLTaKsDq9NPi8ed6rax1v6YQGMXPapOsNsHLko6Q@mail.gmail.com>

On Fri, Apr 3, 2020, 11:12 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
wrote:

> On Fri, Apr 3, 2020 at 6:41 PM Jacob Lifshay <programmerjake@gmail.com>
> wrote:
>
> > I didn't consider it critical information since it can theoretically be
> > automatically regenerated (assuming we wrote our build scripts properly).
>
> mmm... technically... yes.  except a year later, if we want to
> precisely reproduce that exact error (regression testing), and the
> salsa server is no longer available, six months prior?
>

We can build it on any other gitlab installation, if all else fails, we can
install gitlab on jacob-build-server.

Jacob
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 185] Getting 502 Bad Gateway
From: bugzilla-daemon @ 2020-04-03 18:32 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-185-13@http.bugs.libre-riscv.org/>

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

Alain D D Williams <addw@phcomp.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CONFIRMED                   |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Alain D D Williams <addw@phcomp.co.uk> ---
All sites need the lines:

 listen 80 ;
 listen [::]:80;

I have done that with all of them.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 269] auto-conversion / parser of POWER ISA Spec v3.0B
From: bugzilla-daemon @ 2020-04-03 18:37 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-269-13@http.bugs.libre-riscv.org/>

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

--- Comment #7 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
michael i've started doing code-fragments, they're created with
decoder/pseudo/pywriter.py

you'll need to run "make gitupdate" in the top level of the soc
directory, that will pull in the git submodule for the wiki

can you take a look, see what the code "actually" would need to
look like?  i'd like to keep it really clean and simple.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 269] auto-conversion / parser of POWER ISA Spec v3.0B
From: bugzilla-daemon @ 2020-04-03 18:45 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-269-13@http.bugs.libre-riscv.org/>

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

--- Comment #8 from Michael Nolan <mtnolan2640@gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #7)

> can you take a look, see what the code "actually" would need to
> look like?  i'd like to keep it really clean and simple.

What do you mean? I'm looking at the code in fixedarith.py and it looks pretty
good...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] parser precedence, code review / checking needed
From: Luke Kenneth Casson Leighton @ 2020-04-03 18:49 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <CAC2bXD6FrkbjMvBWxWn=2F0cjtzHuOWJUtk2Cs_fOu1MYe8Xcw@mail.gmail.com>

On Fri, Apr 3, 2020 at 7:23 PM Jacob Lifshay <programmerjake@gmail.com> wrote:
>
> On Fri, Apr 3, 2020, 08:20 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
> wrote:
>
> > if anyone knows how to resolve operator precedence, my logic-dyslexia
> > is kicking in and i am having difficulty working out which operators
> > are supposed to be in which order, for bit-wise AND, OR, and
> > PLUS/MINUS, MUL/DIV.  someone else did the PLUS/MINUS MUL/DIV, i'm
> > attempting to add AND and OR and am getting it wrong
> >
>
> The way I always did it is by changing the grammar to have one non-terminal
> symbol per precedence level. Example code from my LR(1) parser generator:
> https://github.com/programmerjake/parser-generator/blob/master/test.parser#L108-L120

ply has something called "precedence" which is a list-of-tuples that
helps resolve parser ambiguities.

> If I were writing the parser I would have used either a hand-written
> recursive descent parser (what I used for the shader-compiler-ir text
> parser) or a PEG parser, since PEGs don't have ambiguity since they are
> defined in terms of the steps taken when parsing instead of being defined
> in terms of what strings the rules can produce (LL(1) and LR(1) parsers).

time.  i've used ply before and we're on the clock.  i was able to
(eventually) find GardenSnake.py which had been abandoned somewhere
around 2006, and got it operational in under 2 hours.

that saved potentially weeks of time over writing a from-scratch parser.

> > +cmpi = """
> > +in_range <-  (x | y) & (a | b)
> > +in_range <-  (x + y) - (a + b)
> > +"""
> >
>
> since there are parenthesis, precedence between &, |, +, and - doesn't
> actually matter here, so it's not a good example.

i'd added them as a way to double-check what the output is (and how it
changes if you do (x&y) | (a&b) rather than as it is at the moment.

astor (btw we need to find a much smaller dependency that can do
tree-dump and to_python_source()) is "smart" - unfortunately - and
only prints out *necessary* brackets.

this is confusing me :)

> Traditionally + and -
> have the same precedence whereas & has higher precedence than | so a & b |
> c parses as (a & b) | c.

i think that's what ("left", BINADD, BINOR) would do.  i'm just not sure.

> Sure, I can figure it out for you if you like. Will be a few minutes.

thanks jacob.

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 185] Getting 502 Bad Gateway
From: bugzilla-daemon @ 2020-04-03 18:50 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-185-13@http.bugs.libre-riscv.org/>

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

Luke Kenneth Casson Leighton <lkcl@lkcl.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lkcl@lkcl.net

--- Comment #9 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Alain D D Williams from comment #8)
> All sites need the lines:
> 
>  listen 80 ;
>  listen [::]:80;

fantastic.

ah!  i previously added ::443 and of course that wasn't it.

thanks alain.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 276] SR NAND Latch needed in nmigen
From: bugzilla-daemon @ 2020-04-03 18:51 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-276-13@http.bugs.libre-riscv.org/>

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

Staf Verhaegen <staf@fibraservi.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |staf@fibraservi.eu

--- Comment #9 from Staf Verhaegen <staf@fibraservi.eu> ---
(In reply to Luke Kenneth Casson Leighton from comment #5)
> (In reply to whitequark from comment #4)
> > Ah, there's another option that you might find interesting. Yosys has a
> > `$sr` coarse cell. 
> 
> yes.  this i _believe_ is what Staf has implemented for us, in the nsxlib
> Cell Library:
> http://bugs.libre-riscv.org/show_bug.cgi?id=154#c21

Not really, I implemented the standard cells implementing the SR latches. A
variant with NOR gates and one with NAND gates and two drive strengths of each.

Yosys and synthesis the logic netlist coming from nMigen needs to mapped to the
cells in the library is on a higher level than what I am doing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 269] auto-conversion / parser of POWER ISA Spec v3.0B
From: bugzilla-daemon @ 2020-04-03 19:11 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-269-13@http.bugs.libre-riscv.org/>

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

--- Comment #9 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Michael Nolan from comment #8)
> (In reply to Luke Kenneth Casson Leighton from comment #7)
> 
> > can you take a look, see what the code "actually" would need to
> > look like?  i'd like to keep it really clean and simple.
> 
> What do you mean? I'm looking at the code in fixedarith.py and it looks
> pretty good...

i know, right! :)

ok so take a look at... mmm... where is it...  power_pseudo.py
and do this:

diff --git a/src/soc/decoder/power_pseudo.py b/src/soc/decoder/power_pseudo.py
index 86306b0..d05ca25 100644
--- a/src/soc/decoder/power_pseudo.py
+++ b/src/soc/decoder/power_pseudo.py
@@ -96,10 +96,10 @@ D <- d0||d1||d2
 """

 #code = testreg
-#code = cnttzd
+code = cnttzd
 #code = cmpi
 #code = cmpeqb
-code = addpcis
+#code = addpcis
 #code = bpermd

 def tolist(num):


then that should modify register 17 to be an (incorrect *sigh*) value
except, arse, right now it doesn't work :)

oh i know why.  forgot to add __bool__.  sorted.  working now.

ok so, if you look at the bits that go round the "exec (code, d)",
you see that the registers are "pre-prepared" (pre-read) into
variables that are dropped into the dictionary (d).

this creates *local* variables (in d) named RA, RT, RB, RS, which can
end up being modified in the code-fragment.

following code-execution, the *modified* variables have to be "extracted"
for storage into the register file.  if they're in fact registers.

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():

https://www.pythondoeswhat.com/2017/03/when-you-can-update-locals.html

then *return* a copy of locals() from the function.


2) make everything class-based (yuk) self.RA, self.RT, blah blah.

this one i feel looks messy.


3) use exec() treating the code as a string

   however using exec() means that if you get a syntax error it's
   impossible to work out where the hell it was.  it's also really slow.


4) do everything as modules (!) yes really.  modules can be executed on-demand

   https://docs.python.org/2/library/runpy.html

   it then becomes possible to drop the global variables into the module
   and also "extract" them afterwards.  will need investigation.

   also might need an __main__submodule.  maybe.   have to test it.


5) other

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* [libre-riscv-dev] [Bug 276] SR NAND Latch needed in nmigen
From: bugzilla-daemon @ 2020-04-03 19:21 UTC (permalink / raw)
  To: libre-riscv-dev
In-Reply-To: <bug-276-13@http.bugs.libre-riscv.org/>

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

--- Comment #10 from Luke Kenneth Casson Leighton <lkcl@lkcl.net> ---
(In reply to Staf Verhaegen from comment #9)
> (In reply to Luke Kenneth Casson Leighton from comment #5)
> > (In reply to whitequark from comment #4)
> > > Ah, there's another option that you might find interesting. Yosys has a
> > > `$sr` coarse cell. 
> > 
> > yes.  this i _believe_ is what Staf has implemented for us, in the nsxlib
> > Cell Library:
> > http://bugs.libre-riscv.org/show_bug.cgi?id=154#c21
> 
> Not really, I implemented the standard cells implementing the SR latches. A
> variant with NOR gates and one with NAND gates and two drive strengths of
> each.

i think that's what i meant.
https://gitlab.lip6.fr/vlsi-eda/alliance-check-toolkit/-/merge_requests/4/diffs

ok so these are called nsnrlatch and srlatch, and there are times-1 and times-4
variants.

> Yosys and synthesis the logic netlist coming from nMigen needs to mapped to
> the cells in the library is on a higher level than what I am doing.

my main reason to cross-ref what you kindly wrote for our use was to highlight
that it had happened.

so let me try to understand:

* yosys $sr (and variants) will need to map to these cells (nsnrlatch_xN
  and srlatch_xN).

  will this need patches (or a plugin) into yosys?

* nmigen will need to map to $sr

  i presume that given that yosys already has $sr, only nmigen will need
  augmenting to produce $sr?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

* Re: [libre-riscv-dev] submitted bugreport to upstream nmigen
From: Luke Kenneth Casson Leighton @ 2020-04-03 19:24 UTC (permalink / raw)
  To: Libre-RISCV General Development
In-Reply-To: <CAC2bXD44_qKw=d94FSyYeX_pSKpaN+a3FygFJvcY+bbkLhnGTg@mail.gmail.com>

On Fri, Apr 3, 2020 at 7:26 PM Jacob Lifshay <programmerjake@gmail.com> wrote:

> We can build it on any other gitlab installation, if all else fails, we can
> install gitlab on jacob-build-server.

which has ridiculous resources (32 GB RAM for a start).  plus, we have
root access so can do backups etc.

would you be happy for frieder to install gitlab on it?  (the more
people doing stuff in parallel the better).

l.

_______________________________________________
libre-riscv-dev mailing list
libre-riscv-dev@lists.libre-riscv.org
http://lists.libre-riscv.org/mailman/listinfo/libre-riscv-dev

^ permalink raw reply

page:   latest

Libre RISC-V Mailing list Archives (accessible via public-inbox)

Archives are clonable: git clone --mirror https://inbox.libre-soc.org/libre-riscv-dev

Example config snippet for mirrors


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git