ChanServ changed the topic of #glasgow to: glasgow interface explorer · code https://github.com/GlasgowEmbedded/glasgow · logs https://freenode.irclog.whitequark.org/glasgow · discord https://1bitsquared.com/pages/chat · production https://www.crowdsupply.com/1bitsquared/glasgow · no ETAs at the moment
electronic_eel has quit [Ping timeout: 260 seconds]
electronic_eel has joined #glasgow
PyroPeter_ has joined #glasgow
PyroPeter has quit [Ping timeout: 260 seconds]
PyroPeter_ is now known as PyroPeter
Foxyloxy has quit [Quit: Leaving]
x56_ is now known as x56
Foxyloxy has joined #glasgow
Foxyloxy has quit [Quit: Leaving]
Foxyloxy has joined #glasgow
_whitelogger has joined #glasgow
Stormwind_mobile has quit [Ping timeout: 256 seconds]
Stormwind_mobile has joined #glasgow
setrofim1 has joined #glasgow
setrofim has quit [Read error: Connection reset by peer]
_whitelogger has joined #glasgow
simukis_ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
simukis_ has joined #glasgow
hthh_ has quit [Ping timeout: 265 seconds]
hthh_ has joined #glasgow
Stormwind_mobile has quit [Ping timeout: 246 seconds]
setrofim1 is now known as setrofim
setrofim has quit [Quit: WeeChat 2.7.1]
Stormwind_mobile has joined #glasgow
mwk has quit [Read error: Connection reset by peer]
mwk has joined #glasgow
FFY00 has quit [Ping timeout: 240 seconds]
FFY00 has joined #glasgow
Sellerie has quit [Quit: Ping timeout (120 seconds)]
Sellerie has joined #glasgow
<d1b2> <Attie> not sure if anyone can offer input here... i'm looking to increase the sample frequency for the frequency counter applet... using a PLL
<d1b2> <Attie> but it's giving lots of zero values, which is unexpected
<_whitenotifier-f> [glasgow] attie synchronize pull request #216: applet.interface.freq_counter: implement a frequency and duty-cycle counter - https://git.io/JTU6D
<d1b2> <Attie> see the last commit in #216
<d1b2> <Attie> it seems that when running at >100MHz, things go wonky
<_whitenotifier-f> [glasgow] attie synchronize pull request #216: applet.interface.freq_counter: implement a frequency and duty-cycle counter - https://git.io/JTU6D
<whitequark> Attie: i'm increasingly unconvinced this should be a core aplet
<whitequark> *applet
<d1b2> <Attie> oh, mind me asking how come?
<whitequark> it's complex and does many different things. that's not to say that makes it bad, it's more that it doesn't necessarily fit my idea of a core applet
<whitequark> it's less "frequency counter" now and more "signal statistics", is it?
<d1b2> <Attie> yeah, that's fair
<d1b2> <Attie> my initial goal was frequency & duty cycle
<electronic_eel> I'd call it "frequency counter with some signal validity checks"
<d1b2> <Attie> this gives those, but also the min/max values over the sample period
<d1b2> <Attie> which help with validation (FM, noise, glitches, etc...), but i'd accept aren't really the job of a frequency counter
<whitequark> i think there's definitely value in having a basic frequency counter that's also very reliable
<whitequark> i wonder if it should be using a ripple counter instead of more common kinds of logic
<whitequark> this lets you do away with PLLs
<whitequark> bsaically, what i'm thinking of is a ripple counter with async clear and enable resynchronized to the input signal
<whitequark> (you only need to enable the 0th bit in a ripple counter)
<whitequark> this way you only use the main FPGA clock as a frequency standard, not to actually count anything
<d1b2> <Attie> so the input signal would go into the first flipflop, in the comb domain?
<d1b2> <Attie> wouldn't the FFSynchronizer be the limiting factor? (from what I've dug into, it is clocked from the sync domain by default)
<d1b2> <Attie> so driving that up would also increase your headroom for frequencies that are "visible"?
<whitequark> with a PLL?
<d1b2> <Attie> possibly?? i'm not sure
<d1b2> <Attie> i need to run off for a bit (sorry), will be back soon...
<whitequark> ou're not *wrong*, what i think is that your approach is unsatisfying rather than incorrect
<whitequark> i.e. purely in terms of frequency counting, a ripple counter, while awkward on LUT FPGAs, excels at the job
<whitequark> this is for two reasons
<whitequark> closely related
<whitequark> first, for the initial FF, you are only limited by the timing of the LUTFF feedback path
<whitequark> which is not entirely clear how fast that is, but it's in hundreds of MHz
<whitequark> i won't be surprised if 400 MHz is possible
<whitequark> second, for every following FF, the frequency is halved, which means that there is no limit to how large the entire counter can be
<whitequark> this is unlike a normal carry chain counter, where the larger it is, the lower fmax is
<whitequark> a ripple frequency counter is something that i think would be very useful and very valuable to have as a core applet
<whitequark> (i say above 400 MHz, but that just means "our level translators are the limiting part")
<electronic_eel> is there a way to add the signal validity checks for changing freq, glitches and so on, to a ripple counter?
<whitequark> don't think so
<whitequark> and i'm fine with that
<whitequark> we can have that *and* a separate signal statistics applet that's more limited and less reliable in terms of signals it accepts
<electronic_eel> hmm. you could sample the values several times and check if there are big deviations
<electronic_eel> but if you have a regular glitch in the signal you won't easily spot it
<whitequark> would you use one of these things (https://www.elprocus.com/wp-content/uploads/frequency-counter.jpg) to spot glitches in a signal?
<whitequark> what i don't like about the PLL plan is that in that case, the FPGA becomes the limiting factor
<whitequark> this isn't inherently bad but we can do better than that, therefore we should
<electronic_eel> don't the better freq counters have statistics modes too?
<whitequark> sure, but that's on top of being a good frequency counter
<electronic_eel> I'd say the question is what you want to use it for. do you want the most accurate frequency counting -> ripple counter. or is there some unknown signal and you want to characterize it -> high/low statistics like attie did it
<whitequark> the applet is called "frequency counter"
<whitequark> and a frequency counter is something i'd like to have as a baseline
<d1b2> <Attie> i'm back... just catching up
<d1b2> <Attie> "we can do better than that, therefore we should" - i'm game for this... perhaps moving what I've currently got into a basic "signal analysis" role
<whitequark> doing a ripple counter will be a bit tricky
<d1b2> <Attie> heh, oh no
<whitequark> first you'll need to set up some indirection
<whitequark> add glasgow.gateware.ripple (see gateware.pll for an example), then a new method in platform.ice40
<whitequark> the actual counter should use SB_* primitives
<d1b2> <Attie> indirection to behave somewhat like an "un-clocked" FFSync?
<whitequark> yes, same kind of deal
<whitequark> each of the stages is a TFF, so a DFF plus INV in a LUT; you'll need to use a LUT with a 0101010101010101 table
<whitequark> using one of the inputs leads to better timings, i don't recall if it's I0 or I3
<d1b2> <Attie> i'll need to go away and look into TFF / DVV
<whitequark> TFF is just a "toggle flip flop"
<d1b2> <Attie> ah okay
<d1b2> <Attie> *s/DVV/DFF/
<whitequark> it's an uncommon term in FPGAs, I worked with CPLDs a bit
<d1b2> <Attie> "using one of the inputs leads to better timings" - interesting - is that measured/reversed, or documented?
<whitequark> it's something you can glean from the official toolchain
<whitequark> but also, think of how a LUT works
<whitequark> it's 4 muxes in a row
<whitequark> well, a 4-deep tree of muxes
<whitequark> naturally if you drive the mux nearmost to the output, you will have the best timings
<d1b2> <Attie> yeah, sounds sensible
<d1b2> <Attie> I'm willing to have a go at a more vanila frequency counter, but it feels like you have ideas of what it should look like, and I might get it wrong / go off track
<d1b2> <Attie> are you okay for me to continue?
<whitequark> sure
<whitequark> you can start with submitting a PR for a ripple counter alone
<whitequark> the way i described
<d1b2> <Attie> ok
<whitequark> i'll walk you through if you get something wrong, so don't worry there
<d1b2> <Attie> thanks
<d1b2> <Attie> i'll relocate the current PR to applet/analysis/basic or similar?
<d1b2> <Attie> and put this new in applet/analysis/frequency ?
<whitequark> i'd prefer to merge a ripple based frequency counter before thinking about this PR at all
<whitequark> it's possible we can compute statistics with ripple counters too
<whitequark> but i don't yet know how
<d1b2> <Attie> ok