Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: $display cell #2310

Closed
jeanthom opened this issue Jul 28, 2020 · 6 comments
Closed

Feature request: $display cell #2310

jeanthom opened this issue Jul 28, 2020 · 6 comments

Comments

@jeanthom
Copy link

A few persons (including myself) have expressed the need for a $display cell that would allow to write things on a console from inside a module (like $display in Verilog). This would make debugging far easier.

Related issue in nMigen: amaranth-lang/amaranth#432

@mwkmwkmwk
Copy link
Member

Could you tell us more about the cell you'd want? What would be the inputs and semantics? Which parts of yosys should support it? (I'd guess Verilog frontend, cxxrtl, Verilog backend?)

@whitequark
Copy link
Member

@mwkmwkmwk Didn't we discuss it in a meeting a few weeks ago?

@whitequark
Copy link
Member

whitequark commented Jul 28, 2020

I believe the semantics we worked out was along the lines of:

module $display(...);
    parameter CLK_ENABLE = 1'b0;
    parameter CLK_POLARITY = 1'b0;
    parameter FORMAT_WIDTH;
    parameter ARGS_WIDTH;
    parameter ARGS_LAYOUT;
    input CLK;
    input EN;
    input [FORMAT_WIDTH:0] FORMAT;
    input [ARGS_WIDTH:0] ARGS;
endmodule

The idea is to have a primitive that maps well to Verilog backend, CXXRTL backend, and formal verification. The function of CLK and EN is the same as elsewhere. ARGS is all of the substitutions, concatenated together. ARGS_LAYOUT is a list of argument sizes pre-concatenation (something like a space-separated list of widths as decimals), to make the argument list unambiguous without any inspection of the format strings.

Synchronous display cells trigger on the clock. Asynchronous display cells trigger on any change of inputs. (This was Claire's suggestion.)

Names subject to bikeshed, of course.

@mwkmwkmwk
Copy link
Member

Yeah, sounds good (I just haven't seen it written down before).

@daglem
Copy link
Contributor

daglem commented Mar 29, 2023

If I understand correctly, this is handled in #2459.

@povik
Copy link
Member

povik commented Sep 28, 2023

This feature has been added under the name of $print cells in #3721.

@povik povik closed this as completed Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants