<whitequark>
wait, in self.addr, do you even need the outer Array?
<phire>
there are 4 "set ports" to the matrix, each set port can set two bits of a row
<whitequark>
it could be a list, I think?
<phire>
yeah, could probally be a list
<phire>
I only statically index into it
<whitequark>
same for row_set
<whitequark>
this shouldn't actually affect the size of the verilog
<whitequark>
but it makes intent more clear
<phire>
yeah
sakirious has joined #nmigen
<phire>
whoops, now I'm crashing quartus_fit
<phire>
(i fixed a bug in my code so quartus_map wasn't removing almost all the registers)
ronyrus has quit [Quit: %me%]
ronyrus has joined #nmigen
<phire>
For all that crazyness, It synthesizes down to a pretty reasonable 2.03 ALUTs per register.
futarisIRCcloud has joined #nmigen
jeanthom has quit [Ping timeout: 240 seconds]
<phire>
Ok, I optimised the code to be more nmigen friendly (I took inspration from the optimisations that synthesis did)
<phire>
nmigen now generations 1.5mb of verilog in 8 seconds
jeanthom has joined #nmigen
jeanthom has quit [Ping timeout: 272 seconds]
Bertl_zZ is now known as Bertl
m4ssi has quit [Remote host closed the connection]
m4ssi has joined #nmigen
Bertl is now known as Bertl_oO
<agg>
would it be possible in pysim to measure 'coverage' of things like FSM states, if conditions true/false, etc, over a test/series of tests?
m4ssi has quit [Remote host closed the connection]
<whitequark>
not at the moment, but it would be a reasonable extension
<whitequark>
that said, sensibly expressing results is difficult
<whitequark>
we could probably produce an SC/CC coverage file for ingestion to some standard tools...
<agg>
maybe even write pycov-compatible outputs, then you could use pycov reporting and xml generation and everything else
<agg>
huh, coverage.py, rather
<agg>
not sure if you can use coverage.py directly (via either its api or its plugin interface) to add different coverage information, rather than just trying to write coverage-compatible outputs, which might be a bit cursed
<whitequark>
coverage explicitly tells you to not write coverage-compatible outputs
<whitequark>
idk, might be worth writing our own, then cxxrtl could use it as well
<agg>
it looks like coverage file tracing plugins can 'claim' a python-or-otherwise file and report coverage for it, which could work for cxxsim, but wouldn't help cxxrtl I guess
<whitequark>
cxxrtl can export coverage information via an API
<whitequark>
so that's not an issue
<whitequark>
awygle: poke?
<awygle>
whitequark: peek
<whitequark>
awygle: up for discussing cxxsim later today?
<awygle>
sure
<awygle>
just ping me whenever
<awygle>
(well whenever within the next approx 12 hours)
<whitequark>
ack
electronic_eel has joined #nmigen
electronic_eel_ has quit [Ping timeout: 256 seconds]
<whitequark>
awygle: mkay, so i'd like to talk about simulation phases & triggering
<awygle>
mk
emeb has joined #nmigen
electronic_eel has quit [Ping timeout: 260 seconds]
electronic_eel has joined #nmigen
<whitequark>
awygle: sorry, got distracted
<whitequark>
i think we actually discussed this earlier
<whitequark>
do you recall if that was public or private?
emeb_mac has joined #nmigen
jeanthom has joined #nmigen
<awygle>
uhh
<awygle>
i don't recall
<awygle>
probably public? we don't talk privately that often
<whitequark>
... i can't believe that was just 3 months ago, i thought it was in 2019
<awygle>
i can't believe it was 3 entire months ago, i thought it was like, last week
<whitequark>
time, huh
<awygle>
yep
<awygle>
so have your thoughts evolved since then?
<whitequark>
they did, and so did the problems i'm facing
<whitequark>
here's my current view of cxxrtl
<whitequark>
cxxrtl generates a eval and commit function, but really it's generating two significantly distinct kinds of code that happen to be squished into the same boxes
<whitequark>
first, it generates code that evaluates combinatorial cells. on a well-behaved netlist (i.e. without combinatorial loops) this code can be fully statically scheduled. we go to great lengths to turn not-quite-well-behaved netlists into entirely well-behaving ones, but if worst comes to worst, this code can be called in a loop until it settles.
<whitequark>
but really, its intended purpose is to be executed once per simulation instant, and the current approach is actually a global performance optimum. nothing to do here.
<awygle>
yep, makes sense
jeanthom has quit [Ping timeout: 246 seconds]
<whitequark>
(this is basically my answer to your earlier "process per cell" suggestion)
<awygle>
mhm
<whitequark>
(there's an interesting detail here where the behavior of fully asynchronous logic / combinatorial loops is essentially undefined beyond "it's fully deterministic", but i digress)
<whitequark>
second, it generates code that evaluates synchronous cells. this is a lot more tricky. scheduling-wise, this code can run at pretty much any order as long as it happens after all the combinatorial cells are evaluated. the trickiness is in the guarding condition.
<whitequark>
the purpose of the guarding condition is pretty much to evaluate synchronous cells when (e.g.) there is a posedge on clk. that doesn't sound very complex. but the exact form of the condition has major ergonomics and performance implications in cxxrtl alone, and cxxsim makes all that twice as complex
jeanthom has joined #nmigen
<whitequark>
let's look at cxxrtl alone first
<whitequark>
how do we detect a posedge on clk? well, an obvious way to do so is during commit: we know the clock just changed, if it's 1 now, we have a posedge.
<whitequark>
however, this requires the clock to be a wire<>.
<whitequark>
so if you have code in a testbench like `top.p_clk.set(true); top.step();` then this will run eval/commit twice: first eval does nothing, first commit detects the edge, second eval/commit is actually useful.
<whitequark>
that's a 2x performance hit which obviously sucks.
jeanthom has quit [Ping timeout: 264 seconds]
emeb has quit [Quit: Leaving.]
<whitequark>
so what i do instead is one of two things:
<whitequark>
- if p_clk is a wire<> after all, i compare p_clk.curr and p_clk.next to see if it's about to be committed, and if it is, i consider that a posedge has happened.
<whitequark>
this is strictly speaking illegal according to my own rules, and unsurprisingly, it causes issues i'll go into later
<whitequark>
- if p_clk is a value<>, i create another value<> prev_p_clk, do `prev_p_clk = p_clk` in commit, and compare them to determine if a posedge has happened.
jeanthom has joined #nmigen
<whitequark>
so, what goes wrong here?
<awygle>
got distracted oops
<awygle>
the former sounds like it could cause issues if the combinatorial logic isn't settled, for one thing
electronic_eel has quit [Ping timeout: 256 seconds]
jeanthom has quit [Ping timeout: 256 seconds]
electronic_eel has joined #nmigen
<whitequark>
awygle: sorry, got distracted
<whitequark>
oh, you too
<whitequark>
ok, so you're right, that is one issue
<whitequark>
another issue is... actually hang on i found a bug