"This footgun has a name: X-optimism. That’s the standard behavior for Verilog: if treats X as false, which incorrectly makes conditional assignments appear defined when they are actually unknown."
TIL, I more and more suspect that my rule about C++ that "Every feature, no matter how trivial, must have a pitfall" applies to Verilog too
@adrian I feel this. I am currently working on our SystemVerilog Frontend for @verijit and I was surprised how differently you think about Verilog when designing hardware vs when writing a simulator. I mean I knew in theory that Verilog is event driven, but the common subset people actually use does conveniently not run into this much.
I feel like I am actually writing half a synthesis toolchain to make our simulator fast. We gained an entire new intermediate representation for this reason.
@adrian Honestly, much of this feels like it comes from the idea that you can do verification and design in a single language + the very "I know it when I see it" approach to defining the synthesizable subset.
Essentially it feels a bit like bolting on a half baked imperative/OO language onto an existing HDL. Having separate languages seems like the way forward here.
(I don't have enough experience with embedded DSLs to really have an opinion on that yet)
@CanLehmann @adrian Yep, performance is a really big downside to it.
I'm really excited for @ethan's https://github.com/ethanuppal/marlin and need to get around to finishing the Spade support for it. Especially with Verilator's upcoming 4-valued simulation support

@thezoq2 @adrian @ethan I mean honestly it seems like the solution to that is to auto generate assert ~$isunknown(...) for all conditions. At least that what I will probably do for verijit (probably with a flag because we still need to support the actual behaviour somehow).
I mean in the if(1'bx) thing is a classic refinement issue, i.e. you are simulating one refinement of your model, but the synthesis tool might refine differently.
@CanLehmann @adrian Yeah, I guess I'm just annoyed by us potentially falling for a footgun like this and having to deal with it
Though on further reflection I remembered that we compile to ternaries and not if
For me with Spade, the complex data types from the HDL is the big selling point of Marlin.
But I also am not sure if C++ is a particularly good choice for a testbench language, so even if I was writing Verilog I think i'd prefer Rust over C++ or taking the performance hit from Cocotb
@CanLehmann @ethan @adrian Oh yeah, Rust certainly doesn't have the market share of C++ yet.
But with that argument, we should also use Verilog :P
@thezoq2 @ethan @adrian Oh yeah sure 🤣
Though I think in this aspirational world, Rust wouldn't be it either for me. I realize that I am going to make myself a bit unpopular in this thread by saying this, but I love C++ for how I can quickly bend it to do whatever I want. The safety vs. extra effort tradeoff has not made sense for me, since most of the bugs I actually sped time debugging are logic issues somewhere in some compiler pass, not memory issues.
Oh yeah, C++ certainly wouldn't be my last choice for a language, I love the fact that if I want to do something, there is almost certainly a way to do it, albeit a hacky one.
The reason I like Rust so much is that it brings a lot of that, but with more type safety and less footguns
@CanLehmann I do need to try swift at some point, from what I hear it has some really good ideas.
And for what it's worth, I've often said that if I had to remove any feature from Rust, it'd be memory safety. I think you're right that logic bugs are more interesting generally, and the rest of the Rust type system does a very good job of catching those in my experience
@CanLehmann For me, memory safety is the thing that brought me to the language, but I'm staying for the functional inspired type system and top tier tooling. I assume I'm not alone in that
I guess it also depends on the context, I use it as a fast high level language for compilers, if I was doing more systems programming I'd care a lot more about memory safety
@CanLehmann @verijit
> I am actually writing half a synthesis toolchain to make our simulator fast
This is a *great* way to distill the ecosystem problem that Verilog causes. If we had better, more language-agnostic representations for hardware, much more of this stuff could be shared between (e.g.) synthesis and simulation.

The Papers track of HOPL-IV will include published papers that will be complemented by oral presentations at the conference. The Program Committee encourages submissions that discuss and analyze the historical development of individual programming languages, programming language families, language features, design themes, and other strong influences on the direction of programming language design, implementation, and usage. Detailed information is listed on separate pages. Click on either the tabs above or the links in the list below. Prospective authors should read the Call for Papers, ...