<whitequark>
awygle: think you could guide GuzTech in nmigen-boards#103,#104?
<whitequark>
i think we already have examples of those resources somewhere in other boards, and #103/#104 should be consistent with those
Degi has joined #nmigen
jaseg has quit [Ping timeout: 244 seconds]
jaseg has joined #nmigen
jeanthom has quit [Ping timeout: 240 seconds]
<tannewt>
what is `defparam` in verilog and how does it map to nmigen? I'm looking at the nmigen EFB
<d1b2>
<edbordin> defparam lets you parametrize your design (e.g. you could make data width a parameter). in nmigen you can just pass parameters into the constructor for your module class
<d1b2>
<edbordin> looks like defparam might also be used to define constants sometimes
<d1b2>
<edbordin> oh but maybe you were asking how to set those params from nmigen if importing some verilog. that I don't know
<tannewt>
ah! I see I can do `p_` as a kwarg for it to be snagged as a parameter by Instance
<d1b2>
<edbordin> ah, nice one
<tannewt>
this should help me fuzz the EFB :-)
<d1b2>
<edbordin> ooh, fuzzing with nmigen, nice idea
<d1b2>
<TiltMeSenpai> you might be able to use this to make a generalized nmigen-based fuzzing thing
<d1b2>
<edbordin> I'm not sure how similar to software fuzzing it is
<d1b2>
<edbordin> I guess you could use it to automatically figure out what configurations are valid for each block rather than setting those enumerations/range up yourself
<pepijndevos>
UserValue seems to be... made for subclassing, but I don't think that immediately lets me do what I want.
<whitequark>
yup
<whitequark>
the thing about nmigen is that it's even lower-level than verilog or vhdl. you don't even really have types; there are "shapes", which are similar to extremely weak types, but don't fulfill quite the same role
<whitequark>
it's a toolkit for constructing RTL netlists. it specifically leaves high-level concepts like types, in the usual sense, out of scope. there's some plumbing for enumerations, but those are still just integers after all
<pepijndevos>
But a shape does track things like signedness. Basically I want a custom shape that also tracks fractional bits.
<whitequark>
you can't do that
<pepijndevos>
hmhm...
<whitequark>
and like i mentioned, it's out of scope, very much on purpose
<whitequark>
shapes provide the bare minimum necessary for synthesis (you need width and signedness to synthesize arithmetics, especially considering DSP inference) and verification (you need enums to have readable VCDs and such)
<pepijndevos>
So what would be the way to do it? Just implement my own *actual* type that implements all the operations and methods to convert to and from nMigen types?
<whitequark>
are you familiar with basics of LLVM IR?
<pepijndevos>
Not really.
<whitequark>
right, nevermind then
<whitequark>
(what would be the way to do it) yes, pretty much. it depends on your precise goals, really
<whitequark>
for example, i would suggest you consider building the entire numeric tower on top of nmigen, including integers
<whitequark>
i.e. don't even allow bare nmigen values as operands
<pepijndevos>
right
<whitequark>
nmigen is a language you can use directly, sure, but it is also a compiler-as-a-library that something HLS-y can target as a backend
<pepijndevos>
Yea, I'm sortof writing a compiler
<whitequark>
(i use a somewhat unorthodox definition of "HLS", which is basically "everything more complex than RTL". Verilog is HLS :)
<pepijndevos>
hehe ok
<whitequark>
or let me rephrase it in a different way
<whitequark>
you might think of nmigen as a convenient way to construct RTLIL
<pepijndevos>
definitely... actually...
<whitequark>
this isn't true in the strictest sense (it's not tied to RTLIL, and it doesn't map 1:1 to RTLIL), but there's a philosophical truth in that statement
<pepijndevos>
What I have not thought through is, if I use my own number types... at some point I need to roundtrip my values through comb/sync and it seems I'd basically have to strip all type info.
<whitequark>
can you describe a specific example of a problem you're anticipating?
<pepijndevos>
ah... hmmm, actually maybe it's fine?? I'd basically just implement eq() to return the assignment of the underlying signal, while my code just uses my own types
<whitequark>
yup
<pepijndevos>
whew... okay I think I'm getting there. as I said... not a typical "hello world" experience haha
<whitequark>
so... the thing about UserValue is that it leaks methods into your namespace, which is a major backwards compatibility hazard
<whitequark>
we've redesigned it just a few weeks ago to fix that, with a much better design
<pepijndevos>
huh?
<whitequark>
well, UserValue inherits from Value, so unless you *un*define them, you'll get all the normal methods that apply to nMigen values, which you probably don't want
<whitequark>
I made that mistake many months ago, when introducing it
<anuejn>
pepijndevos: i have done something similiar to what you want and also went for the route to not subclass UserValue
<anuejn>
section "Calculating with fixed point numbers"
<pepijndevos>
I'll just read the german lol
<pepijndevos>
... some time at least... good night :)
<anuejn>
good night :)
<d1b2>
<286Tech> Fixed-point multiplication of let's say [III.FFFF] x [II.FFFFFF] = [IIIII.FFFFFFFFFF]. That is 3 integer bits and 4 fractional bits times 2 integer bits and 6 fractional bits gives you a 5 integer, 10 fractional bit answer.
<d1b2>
<286Tech> I use it in my fixed-point FFT implementations for my research.
<d1b2>
<286Tech> So a Q8.8 multiplication with give a Q16.16 result. If you want to go back to a Q8.8 format, you'd have to truncate the upper 8 bits, and the lower 8 bits (or perform rounding).
emeb_mac has joined #nmigen
reepca has quit [Read error: Connection reset by peer]
jeanthom has quit [Ping timeout: 246 seconds]
Asuu has quit [Remote host closed the connection]
emeb_mac has quit [Ping timeout: 256 seconds]
emeb has quit [Ping timeout: 256 seconds]
emeb_mac has joined #nmigen
emeb has joined #nmigen
emeb_mac has quit [Ping timeout: 260 seconds]
emeb_mac has joined #nmigen
cr1901_modern has quit [Read error: Connection reset by peer]