clifford changed the topic of #yosys to: Yosys Open SYnthesis Suite: http://www.clifford.at/yosys/ -- Channel Logs: https://irclog.whitequark.org/yosys
danieljabailey has quit [Quit: ZNC 1.6.6+deb1ubuntu0.1 - http://znc.in]
wavedrom has quit [Ping timeout: 244 seconds]
develonepi3 has joined #yosys
emeb has left #yosys [#yosys]
xerpi has quit [Remote host closed the connection]
pie__ has quit [Ping timeout: 252 seconds]
emeb_mac has joined #yosys
pie_ has joined #yosys
citypw has joined #yosys
danieljabailey has joined #yosys
lutsabound has quit [Quit: Connection closed for inactivity]
TD-Linux has quit [Ping timeout: 250 seconds]
TD-Linux has joined #yosys
pie__ has joined #yosys
pie_ has quit [Remote host closed the connection]
rohitksingh_work has joined #yosys
leviathanch has joined #yosys
emeb_mac has quit [Quit: Leaving.]
kc5tja has quit [Ping timeout: 250 seconds]
kraiskil_ has joined #yosys
wavedrom has joined #yosys
wavedrom has quit [Ping timeout: 250 seconds]
pie__ has quit [Remote host closed the connection]
pie__ has joined #yosys
dys has quit [Ping timeout: 272 seconds]
m4ssi has joined #yosys
xerpi has joined #yosys
sigwinch_ has joined #yosys
<sigwinch_> Good morning, #yosys!
<daveshah> Morning sigwinch_!
<sigwinch_> I was asking myself how to properly have a counter have the correct width, based on the number of cycles I want to count, and especially to get rid of a warning when I compare against "number of cycles minus one". Here's what I came up with, and I wanted to ask if that's the proper way or hopelessly ugly:
<tpb> Title: [VeriLog] verilog integer width - Pastebin.com (at pastebin.com)
<daveshah> So personally I'd never worry about such a warning
<daveshah> I think an alternative way might be to do (NCYCLES-1)[CYCLE_CTR_BITS-1:0]
<sigwinch_> Ah, good idea, never thought of that (bit-indexing a integer literal).
<swetland> I believe you need $clog2(N+1) if N could be an exact power of two
<swetland> daveshah: I like the warning in general as it catches assignments of mismatch net-sizes to each other, but it does get entertaining when params/constants are involved
<swetland> as I am reminded elsewhere, don't need the +1 on the clog2 if N-1 is the max value in use
MoeIcenowy has quit [Quit: ZNC 1.6.5+deb1+deb9u1 - http://znc.in]
MoeIcenowy has joined #yosys
citypw has quit [Ping timeout: 258 seconds]
<sigwinch_> daveshah: verilator doesn't like (123)[NBITS-1:0] ...
leviathanch has quit [Remote host closed the connection]
<sigwinch_> ...and yosys doesn't like typedefs ;-).
<swetland> try this in verilator:
<swetland> localparam NCYCLES_1 = NCYCLES - 1;
<swetland> NCYCLES_1[CYCLE_CTR_BITS-1:0]
<swetland> it seems to be willing to slice a param but not an arbitrary expression
<sigwinch_> :-) Very good. Seems to make both yosys, iverilog and verilator happy! Thanks!
kraiskil_ has quit [Ping timeout: 244 seconds]
<swetland> this has been the adventure of verilog/systemverilog for me -- finding the union of features/syntax/dialect that all the tools I want/need to use can understand
<tpb> Title: [VeriLog] verilog counter with dynamic width, 0..(N-1), no warn - Pastebin.com (at pastebin.com)
<swetland> so there's a neat trick for this that someone pointed out to me recently -- if you load the counter to max and then detect the underflow (making the counter one bit wider than you need to be), you don't need an n-bit-wide comparator to detect the trigger/reload -- you just trigger on underflow
<tnt> sigwinch_: in general if you don't need the value, make counter 1 bit wider, init to xxx-2, doing a decrement and look for the msb going high. Avoids the need for a comparator.
<tnt> Arf ... was too slow to type :
<sigwinch_> That's a very useful remark, thanks tnt!
xerpi has quit [Remote host closed the connection]
xerpi has joined #yosys
<sigwinch_> (and of course swetland ;-) ...)
daniel_ has joined #yosys
<swetland> tnt's explanation was much more succinct -- worth the wait ^^
daniel_ has left #yosys [#yosys]
d0nker5 has joined #yosys
<sigwinch_> https://en.wikiquote.org/wiki/Blaise_Pascal - I would have written a shorter letter, but I did not have the time.
<tpb> Title: Blaise Pascal - Wikiquote (at en.wikiquote.org)
leviathanch has joined #yosys
d0nker5 has quit [Ping timeout: 272 seconds]
_whitelogger has joined #yosys
rohitksingh_work has quit [Read error: Connection reset by peer]
citypw has joined #yosys
xerpi has quit [Remote host closed the connection]
xerpi has joined #yosys
xerpi has quit [Remote host closed the connection]
xerpi has joined #yosys
xerpi has quit [Remote host closed the connection]
xerpi has joined #yosys
xerpi has quit [Remote host closed the connection]
kraiskil_ has joined #yosys
lutsabound has joined #yosys
tmeissner has joined #yosys
angelterrones has joined #yosys
develonepi3 has quit [Remote host closed the connection]
develonepi3 has joined #yosys
elaforest has joined #yosys
kraiskil_ has quit [Ping timeout: 240 seconds]
rohitksingh has joined #yosys
kraiskil_ has joined #yosys
kraiskil_ has quit [Ping timeout: 258 seconds]
citypw has quit [Ping timeout: 268 seconds]
kraiskil_ has joined #yosys
emeb has joined #yosys
lutsabound has quit [Quit: Connection closed for inactivity]
jevinskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jevinskie has joined #yosys
d0nker5 has joined #yosys
leviathanch has quit [Remote host closed the connection]
kraiskil_ has quit [Read error: Connection reset by peer]
tmeissner has quit [Quit: Leaving]
m4ssi has quit [Remote host closed the connection]
rohitksingh has quit [Ping timeout: 252 seconds]
kraiskil_ has joined #yosys
dys has joined #yosys
kernlbob has joined #yosys
flaviusb has quit [Remote host closed the connection]
rohitksingh has joined #yosys
wavedrom has joined #yosys
pie__ has quit [Remote host closed the connection]
pie__ has joined #yosys
Laksen has joined #yosys
Laksen has quit [Remote host closed the connection]
angelterrones has quit [Ping timeout: 258 seconds]
rohitksingh has quit [Ping timeout: 252 seconds]
pie__ has quit [Remote host closed the connection]
wavedrom has quit [Ping timeout: 250 seconds]
pie_ has joined #yosys
Kamilion has joined #yosys
X-Scale has quit [Ping timeout: 268 seconds]
X-Scale` has joined #yosys
X-Scale` is now known as X-Scale
pie_ has quit [Remote host closed the connection]
pie_ has joined #yosys
pie_ has quit [Remote host closed the connection]
kraiskil_ has quit [Ping timeout: 268 seconds]
<shapr> ZipCPU: hey! newbie verilog question ... is #mystorm a better place for me to ask?
<ZipCPU> No, this is fine ... what's up?
<shapr> restarted my FPGA class for the year
<FL4SHK> FPGA class?
<shapr> I want to get this FPGA-Synthesizer working on my beaglewire
<FL4SHK> In school?
<shapr> FL4SHK: yeah, I teach a Monday FPGA class here at my job
<shapr> er, no
<FL4SHK> oooh teach
<shapr> FL4SHK: I don't actually know anything about FPGAs!
<ZipCPU> FL4SHK: Corporate lunch time, sweet, huh?
<shapr> that makes it more challenging :-P
<FL4SHK> when I was doing my MS degree I did a bunch of HDL dev
<ZipCPU> Ok, keep going ... synthesizer
<shapr> FL4SHK: I did convince several of my coworkers to buy their own BeagleBone + BeagleWire
<ZipCPU> I have the BBB ... just not the beagle wire
<shapr> ZipCPU: I will happily send you one and some cash
<shapr> you just have to remind me of your contracting fees again
<shapr> aanyway
<shapr> I forked an existing FPGA-Synthesizer
<shapr> but the whole codebase relies on ... I think a 2MHz system-wide PLL
<shapr> and the BeagleWire has a 1MHz? maybe it's 200MHz and 100MHz
<shapr> in any case, all the clock division is done explicitly from the PLL on a Xilinx board
<ZipCPU> Let's see ... you should be able to run the BeagleWire at about 50MHz, maybe more
<shapr> ZipCPU: so my question is, do I need to just divide the existing counts by the difference between the Xilinx and BW clock speeds?
<FL4SHK> Is the BeagleWire an FPGA board?
<shapr> FL4SHK: yes!
<FL4SHK> I see
<FL4SHK> I'd never heard of it
<tpb> Title: BeagleWire | Crowd Supply (at www.crowdsupply.com)
<shapr> FL4SHK: I chose it because you can install yosys directly on the board
<shapr> and my earlier Haskell classes ran into problems installing on a wide variety of operating systems
<ZipCPU> This is good ... keep going
<shapr> ZipCPU: so I think this says the board this was built for is 500MHz: https://github.com/shapr/FPGA-Synthesizer/blob/master/synthesizer.v#L4
<tpb> Title: FPGA-Synthesizer/synthesizer.v at master · shapr/FPGA-Synthesizer · GitHub (at github.com)
<shapr> and I think this says the BeagleWire is 100MHz: https://elinux.org/BeagleBoard/BeagleWire#External_clock_source
<tpb> Title: BeagleBoard/BeagleWire - eLinux.org (at elinux.org)
<ZipCPU> You'll never get the iCE40 up to 500MHz!
<ZipCPU> Sounds like you have a 100MHz clock input, go on
<shapr> I figured I could hack this synthesizer source to work with out of the box beaglewire
<shapr> then I could contribute it as an example
<ZipCPU> Sounds good, go on
<shapr> so my question comes down to "do I just divide all the explicit clock division by five?"
<ZipCPU> Better to use a PLL ... you sure you don't want 50MHz? It's a nice frequency to work at ... ?
<tpb> Title: FPGA-Synthesizer/pmod_out.v at master · shapr/FPGA-Synthesizer · GitHub (at github.com)
<shapr> why is 50MHz a good frequency?
<shapr> hi FL4SHK ! How'd you end up in this nifty community?
<ZipCPU> It's fast, and it's got plenty of room for logic
<FL4SHK> shapr: ZipCPU's influence
* ZipCPU grins broadly
<shapr> good reason!
<shapr> FL4SHK: do you do FPGA stuff for money?
<FL4SHK> I just got my first out-of-college job that I think will be involving that
<shapr> oh cool! So you just finished your Master's? or you went on to get a doctorate?
<FL4SHK> just finished my MS
<shapr> nice!
* ZipCPU showed FL4SHK how to use formal verification methods on his college project. He told ZipCPU it'd never have worked without the formal methods.
<shapr> I'd like to go back and get a master's but it did take me twenty four years from start to finish for my bachelor's
<FL4SHK> oh
<shapr> mind you, I really *enjoy* taking college classes
<FL4SHK> some of mine I actually did really enjoy taking haha
<shapr> I love learning far more than I care about grades
<shapr> my GPA was never impressive, but when I learn something it sticks in my head forever
<shapr> that's all I care about
* shapr swears at pagerduty
<ZipCPU> shapr: If you want to configure a PLL, you'll need both icepll as well as the iCE40 documentation for their PLLs
<shapr> for learning by others, why not just use stock BeagleWire 100MHz and modify the synthesizer to handle that?
<shapr> also, verilog still makes me angry that I can't parameterize clocks
<ZipCPU> You could
<ZipCPU> It's not a bad idea
<ZipCPU> Only problem with 100MHz is ... what happens if you can't get your logic running that fast?
<ZipCPU> Jan Gray suggests, for high speed clocking, pick a clock rate and stick with it--so you might be good
<ZipCPU> My problem is that I started with the ZipCPU at 100MHz on an Artix-7 device ... and so all my logic references are with respect to that experience.
wavedrom has joined #yosys
<ZipCPU> shapr: What kind of speakers do you expect to be using? As in, what interface will they be expecting? I2S? PWM?
<shapr> I have the i2s pmod from digilent that the original author used
tmeissner has joined #yosys
<ZipCPU> What clock speed did he use for it? 1MHz?? That would seem rather odd.
<shapr> i2s is a digital protocol
<tmeissner> Does anyone tried to build SymbiYosys from source?
<shapr> ZipCPU: pagerduty is being needy, I'll return sometime :-/
<tmeissner> I cannot build Avy, I get compilation error
<ZipCPU> tmeissner: I do it all the time
<ZipCPU> shapr: ;)
<tmeissner> I assume that the error results from implicit conversions which are now illegal with the latest C++ standard
<ZipCPU> What machine are you building on? Ubuntu?
<tmeissner> debian
<tmeissner> error: narrowing conversion of '2500023266u' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
<ZipCPU> Let me check if I can build it (Ubuntu 16.04) ... it's been a while since I have
<tmeissner> I get a lot of these during compile
<ZipCPU> Those are probably not an issue
<tmeissner> Not all, some are warnings, but these are errors and result in compilation abort
<ZipCPU> What compiler are you using?
<ddrown> is that gcc 8.x?
<ZipCPU> As in ... what version of which compiler?
* ZipCPU is still using GCC 5.4
<tmeissner> I don't know exactly, I used the apt-get line from the symbiyosys doc
<tmeissner> I look after the version, please wait
<ZipCPU> Try typing "gcc -v"
<ZipCPU> It should show up on the last line of that output
<tmeissner> gcc version 6.3.0 20170516
* ZipCPU just upgraded his avy, is about to start building ...
* shapr grumbles
<shapr> ok so
<shapr> ahem
<shapr> ZipCPU: so I could just divide the clock division counts by five and it'll most likely all work?
<ZipCPU> Generally, you should use a PLL if at all possible for any clock adjustments
<shapr> what does that mean?
<ZipCPU> Most FPGA devices have a series of special PLL hardware blocks within them
<shapr> is the external clock of the BeagleWire not a PLL?
<ZipCPU> No, that's a clock
<ZipCPU> Imagine that to be an incoming square wave toggling at 100MHz
<shapr> FL4SHK: if you ever want advice on writing Python or Haskell code, I can help :-)
<shapr> sure, ok
<ZipCPU> Your goal is to get some other rate ... 20MHz you said
<FL4SHK> shapr: well tbh I've been programming for much longer than I've been writing HDL codehaha
<shapr> yeah, different speeds for different things, yeah
<FL4SHK> Haskell is kind of foreign to me though
<shapr> FL4SHK: I can help!
<FL4SHK> I've used Python enough times to be dangerous with it
<shapr> if you want, not gonna be pushy
<ZipCPU> While it is possible to do something like: always @(posedge i_100mhz_clk) o_20mhz_clk <= ... something appropriate ...
<ZipCPU> You are likely to have all kinds of problems doing so
<FL4SHK> ZipCPU: isn't the "correct" answer to use a counter instead
<shapr> oh, I thought that was how clock dividers work
<ZipCPU> Adjusting the clock speed with a PLL is recommended
<FL4SHK> if (counter[...])
<FL4SHK> at least in FPGA code
<ZipCPU> FL4SHK: No.
<tpb> Title: FPGA-Synthesizer/pmod_out.v at master · shapr/FPGA-Synthesizer · GitHub (at github.com)
<FL4SHK> eh?
<FL4SHK> I'm not suggesting posedge counter[...]
<FL4SHK> that much I know you're not supposed to do
<ZipCPU> shapr: That should work nicely for creating outgoing clocks
<ZipCPU> I was discussing internal clocks, such as you might use in the @(posedge CLOCK) section of your code
<ZipCPU> The other stuff ... have at it
<ZipCPU> ;)
<shapr> there's a difference?
<ZipCPU> Yes
<shapr> I thought the external clock was the same as a PLL
<shapr> in that they're both clock signal sources
<FL4SHK> you definitely don't want to do @(posedge counter)
<FL4SHK> in... synthesizeable code
<ZipCPU> If you use an always @(posedge something) ... use either an externally supplied clock or the output of a PLL (both will work)
<FL4SHK> ^
<FL4SHK> if you want a "clock divider" without using a PLL I'm pretty sure you can do if (counter[...])
* ZipCPU considers sitting back and watching his apprentice teach the lesson ;)
<shapr> FL4SHK: I've been using Python since 1996, but professionally only since 2000
<shapr> dunno if I'm an expert, but I know more than most
<shapr> FL4SHK: ok so... what's the difference between a PLL and an external clock?
<shapr> is the difference that I can change a PLL?
<shapr> is there any functional difference?
<FL4SHK> PLLs need an external clock
<shapr> oh they do?
<FL4SHK> in terms of your FPGA code it probably doesn't matter which one you use?
<FL4SHK> yeah
<FL4SHK> PLLs are like magic to me
<FL4SHK> but I have used them
<shapr> so, a PLL on an FPGA needs an external clock to feed it, but then you can change the default clock speed of your entire .. something?
<ZipCPU> FL4SHK: You didn't read my article on PLL's? ;)
<ZipCPU> shapr: Yes.
<FL4SHK> It'd be neat if I could just make a PLL out of logic but
<ZipCPU> FL4SHK: You can ....
<FL4SHK> Isn't that a bad idea
<FL4SHK> I thought it was a bad idea lol
<shapr> is it?
<FL4SHK> Maybe I'm wrong
<ZipCPU> In general, it is ... but some of the Xilinx hardware has some really curious and useful capabilities ... but we are getting off topic
<ZipCPU> shapr: The basic idea is ... external clock -> (FPGA Boundary) -> PLL -> Clock at whatever rate you'd like (within reason)
<shapr> ok, so a PLL can modify an incoming external clock
<ZipCPU> Yes
<shapr> but you don't get many PLLs?
<ZipCPU> It can cause it to change phase and frequency. Some PLL's can also output multiple clocks with known relationships to each other
<shapr> otherwise I could use them to do clock division for me?
<ZipCPU> No, you don't get many at all.
<ZipCPU> You don't want to use a PLL to create your I2S clocks
<shapr> how is a PLL different from a counter that does clock division?
<shapr> why not?
<shapr> ZipCPU: I swear I need to send you more money
<ZipCPU> Why? Because going through the PLL introduces some amount of ns delay
* ZipCPU does not object
* shapr fires up patreon
<ZipCPU> If you are going to send data out of an FPGA, you really want to make certain all of that data transitions on the same clock interval--so it all has the same timing relationships within it
<ZipCPU> A PLL will give you the right frequency, but will also change phase--usually undesirably--so that you nolonger maintain a known phase relationship with the incoming clock
<somlo> ZipCPU, shapr: isn't the problem with wiring up your own custom PLLs that now your clock signal would be output over "data" wires rather than dedicated "clock" wires the FPGA might be distributing inside itself? (apologies for jumping in randomly like that into someone else's conversation thread :)
<ZipCPU> Hello, somlo!
<ZipCPU> Welcome to the discussion
<shapr> ZipCPU: upgraded to "needy student" :-)
<ZipCPU> Yes, that is one of the possible problems
<ZipCPU> Another one has to deal with making sure the tools can properly do timing analysis on your design
<shapr> since I'm already asking that kind of question
<ZipCPU> It can be dfficult to do that with logic
<ZipCPU> I discussed this in an article some time ago ... I just don't remember which one! :D
<shapr> you have so much content!
<ZipCPU> (It wasn't the main topic of the article)
<shapr> I'm glad you have a patreon, I don't feel as bad about asking piles of stupid questions.
* ZipCPU changes the sentence structure: "You are so content" ... and likes that better
<ZipCPU> lol
<ZipCPU> shapr: Go on, am I helping out with your questions still?
<shapr> yes!
<ZipCPU> So ... I have an I2S controller I built some time ago but never used
<shapr> ok, so PLL could have different phase, hm
<ZipCPU> I got far enough along that I was at the point where I needed to configure the audio chip and ... that's where I got stuck
<ZipCPU> Apparently, a lot of audio devices want some really weird frequency: 48.192 MHz or something like that
<ZipCPU> Creating that frequency is ... not trivial
<shapr> I will happily mail you a digilent i2s pmod to match the one I own
<shapr> and a beaglewire
<ZipCPU> Would love it!
<shapr> heck, I'll mail you a whole kit of goodies
<shapr> because then I can ask noobie questions about those goodies!
<ZipCPU> So far, the only audio out I've done successfully has been with either PWM, or unintentional FM
<ZipCPU> (well, intentional unintentional FM)
<shapr> heh
<ZipCPU> It turns out those GPIO wires can be made to "broadcast" at your favorite frequency ... :D
<shapr> oh, did you see the hackaday article yesterday?
<ZipCPU> One project of mine involved playing Queen on my favorite local Christian radio station
<ZipCPU> Which one?
<tpb> Title: Your USB Serial Adapter Just Became a SDR | Hackaday (at hackaday.com)
<ZipCPU> No, I hadn't seen that one ... I'll look forward to reading it
<tmeissner> ZipCPU I've found a forum wheresome users of ArchLinux ran into the same compile error
<ZipCPU> tmeissner: You might consider trying to build one of the other Avy branches ... you might find it builds easier, but I can't comment on whether or not it would work better
<tmeissner> ZipCPU they fixed it by adding a option to cmake that gcc don't take these errors only as warning
<ZipCPU> Sounds like a good temporary patch
<tmeissner> ZipCPU the master branch of avy is pretty old (2015), so maybe you're right, that one of the other branches don't have this problem
<ZipCPU> Looks like most of the work is being done in the new_quip branch
<ZipCPU> There's also a quip branch which appears to have been stable for half a year or so
<tmeissner> Let's try the new_quip first, I'm a adventurer today :D
<shapr> ZipCPU: so your suggestion was to change the clock signal on the BeagleWire to match the 500MHz of the original board?
<shapr> no wait...
* shapr reads back
<ZipCPU> 500MHz? What runs at 500MHz? The example you shared had 500 kHz in it ..
<shapr> er, I thought the incoming clock was 500MHz for the xilinx board this synthesizer was created to run on?
<ZipCPU> Not likely, that's way too fast
<tpb> Title: FPGA-Synthesizer/pmod_out.v at master · shapr/FPGA-Synthesizer · GitHub (at github.com)
<ZipCPU> I'm pretty sure that's a typo
<daveshah> Given they seem to divide by 25 to get 2MHz it must be a 50MHz clock
<shapr> oh yeh!
<ZipCPU> The code is broken as well ... line 39 shows a classic off-by-one error
<daveshah> Which is much more plausible
<shapr> I just realized that!
<shapr> I'm glad you two can read better than I can
<ZipCPU> daveshah: But they aren't creating 2MHz anywhere ... are they? I'm only seeing kHz number
<ZipCPU> numbers
<daveshah> Well "2000kHz"
<daveshah> Actually 1923kHz as you say
<ZipCPU> Ahh ... okay, that starts to make more sense. I think the incoming clock though is 100MHz though
<ZipCPU> Since they appear to be dividing the incoming clock by 52 ((25+1)*2)
<ZipCPU> (I think that's a bug by the way--you can tell that whoever wrote this didn't formally verify it :D )
<daveshah> It depends if that comment refers to the frequency that block runs at or the frequency of the clock it creates
<daveshah> I also see they have a non constant initial value for sig_tmp
<shapr> daveshah: what does that mean?
<daveshah> *sig_temp
<daveshah> See the initial block
<daveshah> The initial value is set to the sig input
<daveshah> This is not feasible in FPGA hardware, and wouldn't make much sense if it was
<shapr> What's sig?
<shapr> daveshah: you have context I am missing, what does that imply?
<tpb> Title: FPGA-Synthesizer/pmod_out.v at master · shapr/FPGA-Synthesizer · GitHub (at github.com)
<tmeissner> ZipCPU new new_quip branch compiles nearly to the end, but then there is another error, it can't find some file of the boost library
<daveshah> In hardware this would imply sampling sig at the moment the FPGA boots to initialise sig_temp
<shapr> and that's bad?
<daveshah> But FPGAs can't do that
<tmeissner> I will have a look, if it's somewhere else
<daveshah> The synthesis tool will either ignore it with a warning or error out
<shapr> sounds like I should try to throw this codebase into yosys and then squander ZipCPU's time with noobie questions
* shapr sighs
* ZipCPU clones the repo
<shapr> on the good side, it seems like my question has turned into much useful information for me!
* ZipCPU starts adding formal properties ...
<shapr> haha
<shapr> daveshah: I thought sig was passed into the module?
* ZipCPU renames MCLK o_i2s_mclk, LRCLK as o_i2s_lrclk, SCLK as o_i2s_sclk, etc.
* ZipCPU replaces output name with output reg name
* ZipCPU adds `default_nettype none to the top
<daveshah> shapr: yes it's an input to the module (and therefore not a constant, or at least not guaranteed to be one)
* ZipCPU replaces input clk with input wire i_clk
<daveshah> Yosys will probably error out, most tools will ignore it with a warning
<daveshah> As synthesis tools are free to ignore initial blocks if they want too, either behaviour is arguably correct
* ZipCPU replaces sig_temp <= sig; with sig_temp = 0;
* ZipCPU removes "<=" from the initial block, replacing it with "="
* ZipCPU notes that this code never passed a verilator -Wall test
* ZipCPU finds blocking assignments where there should be non-blocking assignments ... (See MCLK = ~MCLK)
* ZipCPU finds references to the (blocking assignment results) at the end of the file. These explain why he thought there was a divide by 26
* ZipCPU notices a lack of a reset, and then tugs at his beard pondering
<somlo> daveshah: prjtrellis examples (https://github.com/SymbiFlow/prjtrellis/tree/master/examples) mention a TinyFPGA Ex board with an 85k ECP5; however, the TinyFPGA EX at https://tinyfpga.com says it's using a LFE5U-25F (i.e., 25k). Did they have a limited-edition 85k one, or is that a typo?
<tpb> Title: prjtrellis/examples at master · SymbiFlow/prjtrellis · GitHub (at github.com)
<somlo> daveshah: nvm, I meanwhile found https://www.crowdsupply.com/tinyfpga/tinyfpga-ex :)
<tpb> Title: TinyFPGA EX | Crowd Supply (at www.crowdsupply.com)
<shapr> ZipCPU: I know some of those things
<shapr> does that mean you should not do <= in the initial block?
<ZipCPU> Verilator can't handle "<=" within an initial block
<ZipCPU> Yosys can't handle "=" within a memory initialization in an initial block
<ZipCPU> Sigh
<shapr> how would I recognize a memory initialization?
<shapr> I should read all the ZipCPU tutorials first
* ZipCPU rummages
<ZipCPU> Memory initialization is currently discussed in my (still draft) lesson 8: Block RAM
<ZipCPU> Let me post a slide from that lesson though ..
<tpb> Title: Imgur: The magic of the Internet (at imgur.com)
<ZipCPU> Here's some of the rules I use to make certain the memories I create/define are inferred properly: https://imgur.com/a/cISRlrS
<tpb> Title: Imgur: The magic of the Internet (at imgur.com)
<ZipCPU> I think rule #2 is perhaps the most common frustration among beginning designers using memory
<shapr> oh
<shapr> ram init seems sensible enough
<shapr> ZipCPU: if you have multiple always blocks, do they act as one?
<ZipCPU> Officially: No Unofficially, it might depend by what you mean
<ZipCPU> I typically write my designs with as many always blocks as I have variables, or just shortly less than that--mostly for cost savings
<shapr> mostly wondering if multiple always blocks in the same module are equivalent to one always block with the same code
<ZipCPU> Roughly, yes, but it doesn't work in reverse
<shapr> because ordering?
<ZipCPU> Ordering, yes, and also references to things within the block
<ZipCPU> The simulator is free to pick whatever order it wants to execute the always blocks using
<ZipCPU> This is where blocking (=) vs non-blocking (<=) gets ugly
<shapr> yeesh
<shapr> not sure I actually like verilog
<ZipCPU> If you have a blocking (=) assignment in one always block, and a reference to the value in another, which will get executed first?
<shapr> but it's what I have
<ZipCPU> You'll also have problems with Verilator ... it doesn't handle blocking assignments (=) very well
<ZipCPU> To avoid hardware/simulation mismatch, always use the non-blocking operator (<=) within any clocked always block, and the blocking operator (=) within any combinatorial always block
<ZipCPU> (That much was in the tutorials ... see lesson two)
<tmeissner> I think there are some goop papers from sunburst regarding thi problems with (non)blocking assignments
<ZipCPU> Could be ... but I don't remember seeing any such papers
<ZipCPU> I might need to look again--that would be valuable
<adamgreig> what's the deal with always @* begin bla = 1'h0; bla = some_other_sig; end
<tmeissner> But the hint of ZipCPU is best for beginners I think
<adamgreig> odd syntax for initialise to 0 and thereafter combinatorially equal to some_other_sig?
<ZipCPU> adamgreig: Not at all. the first assignment will be ignored in favor of the second.
<tmeissner> I can remember to some Verilog 4 VHDL users course at Doulos. And this problem was handled very at the beginning
<adamgreig> where bla is "reg bla"
<adamgreig> ZipCPU: so the first assignment is meaningless?
<somlo> "always @*" is combinational, though (always_comb in System Verilog)
<ZipCPU> adamgreig: Yes
<adamgreig> yea, so why would you write two blocking assignments in a combinatorial block to the same register?
<somlo> as opposed to always @(some_edge some_signal), which is where you'll want to limit yourself to nonblocking
<somlo> adamgreig: so you can have Verilog sort things out for you: bla = 0; if (something) then blah = 4'hF; else ... etc
<adamgreig> i mean just literally "reg foo; always @* begin foo = 1'h0; foo = other_sig; end"
<somlo> you get a default value, and if some conditions are true you might end up assigning something else -- but you'll always have assigned *something* to it
<somlo> I think that's redundant (legal, but the 1'h0 thing gets optimized out)
<ZipCPU> See page 5 for example
<adamgreig> hmm I think the intent here is probably assigning initial values
<adamgreig> this is yosys-generated verilog from rtlil
<ZipCPU> No, I don't think so, since that wouldn't assign an initial value
<ZipCPU> I think the intent is to make sure some value, any value, is assigned--to avoid latches
fsasm has joined #yosys
angelterrones has joined #yosys
tmeissner has quit [Quit: Textual IRC Client: www.textualapp.com]
fsasm has quit [Remote host closed the connection]
flaviusb has joined #yosys
dys has quit [Ping timeout: 268 seconds]
elaforest has quit [Ping timeout: 256 seconds]
tac-tics has joined #yosys
tpb has quit [Remote host closed the connection]
tpb has joined #yosys