ChanServ changed the topic of #yosys to: Yosys Open SYnthesis Suite: https://github.com/YosysHQ/yosys/ | Channel logs: https://libera.irclog.whitequark.org/yosys/
tpb has quit [Remote host closed the connection]
tpb has joined #yosys
adjtm has quit [Read error: Connection reset by peer]
adjtm_ has joined #yosys
peepsalot has quit [Ping timeout: 255 seconds]
peepsalot has joined #yosys
bl0x_ has joined #yosys
bl0x has quit [Ping timeout: 256 seconds]
adjtm_ has quit [Ping timeout: 265 seconds]
krispaul has quit [Remote host closed the connection]
krispaul has joined #yosys
krispaul has quit [Read error: Connection reset by peer]
krispaul has joined #yosys
indy has quit [Ping timeout: 276 seconds]
chaoticryptidz_ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
chaoticryptidz has joined #yosys
adjtm has joined #yosys
adjtm has quit [Remote host closed the connection]
adjtm has joined #yosys
<Forty-Bot> does anyone have suggestions on how to parametrize the number of states in a state machine?
<Forty-Bot> I am writing a module where some data is read in byte-by-byte, and I'd like to make the number of bytes parametric https://paste.debian.net/1274608/
<tpb> Title: debian Pastezone (at paste.debian.net)
<Forty-Bot> this is a stripped-down version for experimentation, in the real module there are a lot more states
<Forty-Bot> however, there is a difference in module size between the parametrized and non-parametrized versions
<Forty-Bot> I also tried using a counter, however this ended up taking even more resources https://paste.debian.net/1274609/
<tpb> Title: debian Pastezone (at paste.debian.net)
<Forty-Bot> I am using synth_ice40 for testing
adjtm has quit [Read error: Connection reset by peer]
<bl0x_> Forty-Bot: best to use a counter for the current byte and have the destination range depend on the value of the counter. The counter start value would be the parameters you pass in to the module.
<Forty-Bot> I tried that in the second link
<bl0x_> Ah, oops didn't read that far .. haha
<Forty-Bot> I would love to use that approach, but it takes more resources...
<bl0x_> Hm, what about a one hot counter?
<Forty-Bot> I think it's because yosys doesn't allow arithmetic to be part of state machines
<Forty-Bot> so any time you have something like `state_next = state - 1` or whatever, it disables the FSM optimization
<Forty-Bot> I'll try a 1-hot...
<bl0x_> What about generating code? Or does it need to be dynamic at run time?
<Forty-Bot> the rest of the project doesn't use code generation, so ideally I'd like to use parameters
<bl0x_> I meant to use a generate block. Not some external code generator
<Forty-Bot> 1-hot is better, but still not as good
<Forty-Bot> a generate block would be pretty awful because there are ~7-8 other (unparametrized) states
<bl0x_> Could you put in all states and then skip the unnecessary ones based on the parameter?
<Forty-Bot> yes, that's what happens in the first example when PARAM is set
<bl0x_> Ok.
<bl0x_> About the generate blocks: can't you generate only the additional states inside the fsm surrounded with 'generate if ... ' ?
<Forty-Bot> no
<Forty-Bot> generates are not allowed in always blocks
<Forty-Bot> definitely what I would have done given the choice
<bl0x_> Pretty sure that works in vhdl, no?
<Forty-Bot> no clue; I've only really used verilog
<tnt> I mean, this looks like this should be a shift register really ...
<Forty-Bot> tnt: for size 16 shift registers are larger
<Forty-Bot> but not by too much
<Forty-Bot> however, the parametrized version is still larger
<tpb> Title: module test #( parameter integer WIDTH = 32)( input clk, rst, - Pastebin.com (at pastebin.com)
<Forty-Bot> it's part of a larger state machine
<tnt> Well, we can't optimize something you doesn't give us ...
<Forty-Bot> so something like that isn't really what I had in mind... although that's a different way of approaching things
<tnt> but this should be implementable as a single state in it, just waiting for the last 'ena' to get out of that state.
<Forty-Bot> tnt: well, I wanted to start with something small which didn't have a lot of extra stuff in it
<Forty-Bot> right now the counter is constant 1, but I would like to also support different values based on DATA _WIDTH
notafile[m] has joined #yosys
<notafile[m]> nya!
<gatecat> mrow?
Guest25 has joined #yosys
Guest25 has quit [Client Quit]
nonchip has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
nonchip has joined #yosys