clifford changed the topic of #yosys to: Yosys Open SYnthesis Suite: http://www.clifford.at/yosys/ -- Channel Logs: https://irclog.whitequark.org/yosys
sorear has quit [Ping timeout: 276 seconds]
sorear has joined #yosys
_whitelogger has joined #yosys
emeb_mac has quit [Ping timeout: 245 seconds]
GoldRin has joined #yosys
PyroPeter has quit [Ping timeout: 252 seconds]
PyroPeter has joined #yosys
hca has quit [Ping timeout: 276 seconds]
AlexDaniel has quit [Ping timeout: 272 seconds]
emeb_mac has joined #yosys
dys has joined #yosys
_whitelogger has joined #yosys
emeb_mac has quit [Ping timeout: 258 seconds]
dys has quit [Ping timeout: 250 seconds]
_whitelogger has joined #yosys
Laksen has joined #yosys
_whitelogger has joined #yosys
proteusguy has quit [Ping timeout: 244 seconds]
proteusguy has joined #yosys
lutsabound has joined #yosys
citypw has joined #yosys
citypw has quit [Ping timeout: 258 seconds]
<pepijndevos> How does yosys represent x in sigspec?
<pepijndevos> There is a constructor that just takes an unsigned int, and ones that take various other representations.
<daveshah> pepijndevos: you want SigSpec(RTLIL::State bit, int width = 1);
<daveshah> With State::Sx
<pepijndevos> daveshah, oooh, thanks. And if I want a vector of them?
<pepijndevos> Seems I can make it into a const and use that?
<daveshah> If they aren't all Sx, you probably want to use RTLIL::Const
<daveshah> Yup
<pepijndevos> fancy fancy
<pepijndevos> How can I break on a log_assert?
<pepijndevos> ERROR: Assert `is_fully_const() && GetSize(chunks_) <= 1' failed in kernel/rtlil.cc:
<pepijndevos> 3720
<pepijndevos> I'm a bit perplexed how it can be not fully const when I just created it from a constant
<pepijndevos> ohhhh I see... it's from something else
<pepijndevos> oh no!
<pepijndevos> Seems in yosys an adff takes a constant reset and in this case the reset value is not actually constant
<pepijndevos> Would I have to do a dff+mux instead?
<daveshah> Yosys doesn't have a first class primitive for a non constant *async* reset value
<daveshah> A dff+mux would be the way to go for a *sync* non constant reset value
<daveshah> But that wouldn't involve an adff in any case
<daveshah> If you want a non constant async reset value then you'll need to use a dffsr and some steering logic
<pepijndevos> Oh shit...
<pepijndevos> So an Adff is an asynch d flip flop with a reset value?
<daveshah> Yes, a dff with a constant async reset value
<daveshah> A dffsr is a dff with both an async set and reset
<daveshah> Not that most FPGAs that Yosys supports don't support such a primitive
emeb has joined #yosys
<pepijndevos> If I use sync reset it's fine. Asynch reset with non-constant reset value is such an edge case I'll ignore it for now.
<daveshah> Sounds good
<pepijndevos> Maybe I should add a nice error message though. I see log_assert being used, but that doesn't have a message. Do I just do if() log_error?
<daveshah> Basically, but if you have a filename and line number you should use log_file_error not log_error
<pepijndevos> Ah, hmmm, so it'll tell the user which line... lemme check.
<daveshah> Yeah, it's generally preferred for frontend errors
rohitksingh has joined #yosys
<GenTooMan> Anyone know of an IDE that will work with Icarus and Yosys? I happen to be use to Eclipse but I don't expect anything their as Eclipse is SO Java centered it's hard to get a decent plugin for anything other than Java.
lutsabound has quit [Quit: Connection closed for inactivity]
<ZirconiumX> GenTooMan: I think you expect too much of the Verilog tooling and ecosystem
rohitksingh has quit [Ping timeout: 245 seconds]
bwidawsk has quit [Quit: Always remember, and never forget; I'll be back.]
bwidawsk has joined #yosys
<pepijndevos> How does one use symbiyosys with vhdl?
<daveshah> I'm assuming you want to know behaviour in the commercial suite (SES). VHDL asserts are supported but at present there is no support for assumes
<daveshah> They would have to be in a Verilog module (possibly using bind)
<pepijndevos> I don't even know the difference between assert and assume yet. But yea, SES.
<pepijndevos> Does VHDL have stuff like (* anyconst *)?
<daveshah> It has attributes, yes
Laksen has quit [Quit: Leaving]
<pepijndevos> Eh, so can you do useful stuff without assume, or do you practually have to write your testbenches in verilog?
<daveshah> You pretty much need assume
<pepijndevos> Alright, sad, but maybe I'll learn some actual verilog on the way...
<ZirconiumX> What does SES provide over FOSS Yosys? Verific parser support, commercial support; what else? Out of pure curiosity.
<daveshah> Verific and support are the main things, but also some things like extra formal verification IP for verifying things like AXI cores
<daveshah> Plus everything is prebuilt in a distribution-independent way
<ZirconiumX> That's fair enough. Presumably the money goes towards paying Clifford et al.
<daveshah> Yes
<daveshah> FYI, there are free licenses for OSHW/non-commercial research, see the bottom of https://www.symbioticeda.com/seda-suite
mithro has quit [Read error: Connection reset by peer]
mithro has joined #yosys
<pepijndevos> I am so confused...
<pepijndevos> Can I see a trace if the thing passed?
<daveshah> There is no trace if the thing passed
<ZipCPU> Unless you run cover
<daveshah> This is true
<ZipCPU> Using cover() you can get traces from when things pass
<pepijndevos> How do I tell the thing to start in reset?
<daveshah> Although it is important to remember that when FV passes, the solver has checked every possible path through the design
<ZipCPU> You should be able to do: initial assume(i_reset);
<ZipCPU> However, Verific doesn't support "initial" assumes or asserts (yet)
<ZipCPU> An alternative would be to do something like: initial f_past_valid = 0; always @(posedge i_clk) f_past_valid <= 1; always @(*) if (!f_past_valid) assume(i_reset);
<pepijndevos> Ehhhh, that's so ugly I wonder if I'm taking the wrong approach?
<ZipCPU> The "right" answer here is to "fix" Verific.
<ZipCPU> You could also write for the block with the assumption: assume property (@(posedge i_clk) !f_past_valid |-> i_reset);
<daveshah> In general you need the f_past_valid for other stuff anyway, so it's not as bad is it looks
<daveshah> Something I've thought would be fun would be a small Yosys pass that creates this logic automatically, just given the name of your reset port/signal
<pepijndevos> Okay, I think I passed my first assertion... but without a trace how do I know it even left reset...
<ZipCPU> daveshah: Yes. Clifford and I discussed this sort of thing last week
<ZipCPU> I asked for an "asic" option that would throw out initial statements, assume an initial reset, and only check assertions on the next clock cycle
<daveshah> You could also have something that automatically does the f_past_valid stuff whenever it sees $past etc
<ZipCPU> We both agreed we *should* have an option like that, but the more we discussed it the more difficult the details turned out to be
<daveshah> Ah
<daveshah> pepijndevos: as ZipCPU says, this is where you probably want to use cover
<ZipCPU> Yosys once had an option for generating a trace automatically. It might even still be there. The problem I found with that option was that the trace was typically quite irrelevant
<pepijndevos> I see... but he also said you don't use them at the same time, so do you write two testbenches?
<ZipCPU> No--you place cover() statements side by side with your assert()/assume() statements
<ZipCPU> Then you run the tool twice--once in either bmc or prove mode, and once in cover mode
<pepijndevos> ah
<pepijndevos> So do you need to have two sby files? or can you have multiple modes?
<ZipCPU> You can have multiple modes in the same sby file
<pepijndevos> hm ok
<ZipCPU> To do that, you need a [tasks] section--I typically place it at the top
<pepijndevos> oh ok
<ZipCPU> I also typically place two tasks under neath it. All the tasks have names you assign, but I like to pick "prf" and "cvr"
<ZipCPU> Then on any line to be executed in prove mode, I prefix it with "prf:"
<pepijndevos> ah I see
<ZipCPU> Any line to be executed in cover mode gets prefixed with "cvr"
<tpb> Title: Reference for .sby file format SymbiYosys 0.1 documentation (at symbiyosys.readthedocs.io)
<ZipCPU> Ah, yeah, that's it
<ZipCPU> pepijndevos: Here's an example from when verifying Xilinx's AXI-lite core: https://github.com/ZipCPU/wb2axip/blob/master/bench/formal/xlnxdemo.sby
<tpb> Title: wb2axip/xlnxdemo.sby at master · ZipCPU/wb2axip · GitHub (at github.com)
<tpb> Title: wb2axip/xlnxdemo.v at master · ZipCPU/wb2axip · GitHub (at github.com)
<ZipCPU> And my report on the bugs I found here: http://zipcpu.com/formal/2018/12/28/axilite.html
<tpb> Title: Using a formal property file to verify an AXI-lite peripheral (at zipcpu.com)
<ZipCPU> pepijndevos: Have you found my course notes for using Symbiotic EDA Suite to verify VHDL designs?
<pepijndevos> ZipCPU, eh no, I have not.
<ZipCPU> Look for the link to the VHDL slides on this page: https://zipcpu.com/tutorial/
<tpb> Title: Verilog, Formal Verification and Verilator Beginner's Tutorial (at zipcpu.com)
<ZipCPU> You should there find the course notes for the VHDL course, as well as several examples to work through
<pepijndevos> Bookmarked. I can't think straigt anymore. I added an assertion and the output looks fine to me but apparently it's a failure.
<ZipCPU> Did your assertion use $past()?
<pepijndevos> no
<ZipCPU> Care to post it somewhere, so I can take a look?
<pepijndevos> It's just virtually the same as the previous one except it's a different opcode.
* ZipCPU looks for the "previous one" ...
<pepijndevos> t
<pepijndevos> hold on
<pepijndevos> lemme add the remaining asserts so I can commit something sane
<ZipCPU> Don't tell anyone, but I typically browse several forums each morning just looking for code I can try the formal tools on
<ZipCPU> So .... debugging the code of others is something I tend to enjoy
<pepijndevos> does binary and have any footnukes?
<ZipCPU> ?
<pepijndevos> I'll show you, ready to commit, just need to make a github repo.
<pepijndevos> Uhg... quick, give me a name for a bit serial CPU haha
<ZipCPU> footnuke-and-fiance-free ?
<tpb> Title: GitHub - pepijndevos/seqpu: A bit-serial CPU (at github.com)
emeb_mac has joined #yosys
<ZipCPU> Cloned!
<pepijndevos> Other advice on useful properties to test and stupid things I'm doing of course very welcome
<ZipCPU> :D
<ZipCPU> Okay, so how about: cover property (@(posedge i_clk) opcode == 3'b000 ##1 );
<ZipCPU> Hmm ... that reset might get in the way
<ZipCPU> How about: cover property (@(posedge i_clk) disable iff !rst; opcode == 3'b000 ##1 );
<pepijndevos> What does that do?
<ZipCPU> So an assert() does anything it can to make the expression within false, a cover() is the opposite
<ZipCPU> A cover statement will do anything to make the expression within the cover statement tru
<pepijndevos> Right, so it'd just set the opcode to 000?
<ZipCPU> (opcode == 3'b000) is a test for a clock cycle where thee opcode is 000
<ZipCPU> ##1 means go to the next clock cycle
<ZipCPU> So the result would be a trace showing the opcode == 3'b000 on one cycle, but not ending 'til at least the next
<ZipCPU> Further, the disable iff statement makes it so that it will have to pick a time when the reset value is low
<ZipCPU> Err ... high in your case, since your resets are all using negative logic
<ZipCPU> It'd be sort of like: always @(posedge i_clk) cover(initial_reset && $past(opcode != 3'b000) && $past(rst) && rst);
<pepijndevos> It's bedtime for me, but my sleepy brain just doesn't get what it shows that opcode is 0, because it's just an input.
<ZipCPU> No, sleepy brain probably gets
<ZipCPU> gets it
<ZipCPU> We can discuss more tomorrow if you'd like
<pepijndevos> Gladly
<pepijndevos> Have a nice day :)
<ZipCPU> o/
<pepijndevos> Last thought: In the whole CPU it would very much make sense to verify that the opcode can't change mid-instruction XD
emeb_mac has quit [Quit: Leaving.]
<ZipCPU> Absolutely!
<ZipCPU> Quoted from online: "I cannot understand your code because I learnt [sic] VHDL only". Poor guy. Even before I learned (some) VHDL (thanks daveshah!) I could still understand most of it.
bwidawsk has quit [Quit: Always remember, and never forget; I'll be back.]
bwidawsk has joined #yosys
emeb has quit [Quit: Leaving.]
Stroboko1p has quit [Ping timeout: 246 seconds]
tpb has quit [Remote host closed the connection]
tpb has joined #yosys