amaranth icon indicating copy to clipboard operation
amaranth copied to clipboard

Add support for Print in simulation

Open whitequark opened this issue 5 years ago • 6 comments

A Display feature, similar to Verilog $display, has been requested a few times. We would depend on Yosys to implement it, which in fact is strongly in favor of having it.

Related to #427.

whitequark avatar Jul 13 '20 10:07 whitequark

Why would yosys need to support the display cell? Is the thought that there would be an m.d.comb += Display(f’foo {bar}’}?

And that yosys right now doesnt accept verilog with Display?

I don’t imagine that yosys has anything useful it could do with Display except in the case of CXXrtl, so perhaps Yosys would mostly ignore Display?

BracketMaster avatar Nov 01 '20 15:11 BracketMaster

Is the thought that there would be an m.d.comb += Display(f’foo {bar}’}?

Yes.

I don’t imagine that yosys has anything useful it could do with Display

It should read and write Verilog with $display statements. Some reasons why that's necessary are:

  • LiteX integrates with nMigen through Verilog;
  • Using nMigen with iverilog or Verilator.

whitequark avatar Nov 01 '20 15:11 whitequark

I'm assuming we wouldn't use f-strings because that evaluates the expressions before passing control to the called function. Something more like m.d.comb += Display(s, *args, **kwargs) which does the equivalent of s.format(args, kwargs) except in $display language?

Also, is there an RTLIL equivalent?

RobertBaruch avatar Nov 21 '20 16:11 RobertBaruch

Something more like m.d.comb += Display(s, *args, **kwargs) which does the equivalent of s.format(args, kwargs) except in $display language?

Yep.

Also, is there an RTLIL equivalent?

Not yet, but I'm working on it, like, right now.

whitequark avatar Nov 21 '20 16:11 whitequark

Not yet, but I'm working on it, like, right now.

I kinda figured because now I recall the big meows about $display last week on Twitter :D

RobertBaruch avatar Nov 21 '20 16:11 RobertBaruch

FWIW I have some WIP here that I'm planning to turn into something neat and PR-able in the coming days.

ghost avatar Aug 22 '23 02:08 ghost

Support for this feature has been accepted via RFC 50 and implementation is tracked in issue #1186.

whitequark avatar Mar 04 '24 23:03 whitequark