# `error at item position is a compiler directive, passed through verbatim `ifdef PICOSOC_V `error "icebreaker.v must be read before picosoc.v!" `endif module m; endmodule ---- `ifdef PICOSOC_V `error "icebreaker.v must be read before picosoc.v!" `endif module m; endmodule ==== # `warning is the same directive, and is re-indented like `ifdef is module m; `ifndef SYNTHESIS `warning "simulation-only build" `endif endmodule ---- module m; `ifndef SYNTHESIS `warning "simulation-only build" `endif endmodule ==== # a generate-if whose whole body is an elaboration task, no begin/end module popcount #(parameter int unsigned INPUT_WIDTH = 8) (); if (INPUT_WIDTH < 1) $error("INPUT_WIDTH must be larger or equal to 1."); endmodule ---- module popcount #(parameter int unsigned INPUT_WIDTH = 8) (); if (INPUT_WIDTH < 1) $error("INPUT_WIDTH must be larger or equal to 1."); endmodule ==== # $error inside a labelled generate block, arguments broken onto their own lines module m #(parameter int SYNC_STAGES = 2) (); if (SYNC_STAGES < 3) begin : gen_elaboration_assertion $error("The clearable 2-phase CDC with async reset", "synchronization requires at least 3 synchronizer stages for the FIFO."); end endmodule ---- module m #(parameter int SYNC_STAGES = 2) (); if (SYNC_STAGES < 3) begin : gen_elaboration_assertion $error( "The clearable 2-phase CDC with async reset", "synchronization requires at least 3 synchronizer stages for the FIFO." ); end endmodule ==== # $fatal at module scope, guarded by an `ifndef module m; `ifndef RVFI $fatal("Fatal error: RVFI needs to be defined globally."); `endif logic v; endmodule ---- module m; `ifndef RVFI $fatal("Fatal error: RVFI needs to be defined globally."); `endif logic v; endmodule ==== # $warning whose argument list opens on the next line joins back onto one module m; if (SHOW_WARNING) begin : gen_elab_warning $warning( "This clock divider is deprecated ", "use clk_int_div instead. "); end endmodule ---- module m; if (SHOW_WARNING) begin : gen_elab_warning $warning("This clock divider is deprecated ", "use clk_int_div instead. "); end endmodule ==== # elaboration tasks inside generate case items module m; case (ARBITER) "rr": begin : gen_rr $info("round robin"); end default: begin : gen_arb_error $fatal(1, "Invalid value for parameter 'ARBITER'!"); end endcase endmodule ---- module m; case (ARBITER) "rr": begin : gen_rr $info("round robin"); end default: begin : gen_arb_error $fatal(1, "Invalid value for parameter 'ARBITER'!"); end endcase endmodule ==== # comments around an elaboration task item are kept on both sides module m; // why this is illegal $error("nope"); // and a trailing note endmodule ---- module m; // why this is illegal $error("nope"); // and a trailing note endmodule ==== # an elaboration task inside a format fence comes out byte-exact module m; // verilog_format: off $error( "spaced" , "out" ); // verilog_format: on wire a; endmodule ---- module m; // verilog_format: off $error( "spaced" , "out" ); // verilog_format: on wire a; endmodule ==== # an elaboration task that lands exactly on the 100-column limit stays on one line module m; $error("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); endmodule ---- module m; $error("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); endmodule ==== # one column over the limit and the argument list breaks module m; $error("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); endmodule ---- module m; $error( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" ); endmodule