SystemVerilog probes · 23cVivado: supported
a package in its own file (pkg.sv), referenced as cfg_pkg::NAME
Vivado: supported. The open-source chain: all four stages pass.
| stage | today |
|---|---|
| rtl, simulation | pass |
| synth, synthesis | pass |
| netlist, the netlist | pass |
| bit, the bitstream | pass |
What does Vivado do with it?
Supported. UG901 v2023.2 Ch.10 Table 27 (p.288): 'Package declarations', 'Referencing data in packages': Supported; the guide does not say which file a package is declared in
What does the open-source chain do with it?
since #33 the CLI hands pkg.sv first, before the file that names cfg_pkg: rtl: 'iverilog -g2012 -o top_sim pkg.sv design.sv tb.sv', PASS; bit: read by yosys' own reader, 'pnr ok: 2 LUT, 0 FF, no clocked paths, timing not applicable'; netlist: 'EQV PASS: 1048576 output bits compared, all equal'. Before #33 the scan (PKG_AWK) stopped both dewfpga sim and dewfpga bit at the first reference (line 2) with ERROR [package-file-not-given], since the CLI handed the tools only the files that hold a module
Which error pages explain the messages?
- package-file-not-given: The package lives in a file the tools are not given: a .svh or .vh that no design file `includes, or a file outside the folder or the project.
What is the probe's code?
From test/sv/23c_package_own_file.
design.sv
module top(input logic [15:0] sw, output logic [15:0] led);
assign led[3:0] = cfg_pkg::MAGIC ^ sw[3:0]; // cfg_pkg lives in pkg.sv
assign led[7:4] = sw[7:4] << cfg_pkg::SHIFT;
assign led[15:8] = '0;
endmodule
pkg.sv
package cfg_pkg;
localparam logic [3:0] MAGIC = 4'hA;
parameter int SHIFT = 1;
endpackage
tb.sv
module tb;
reg [15:0] sw = 16'h0000;
wire [15:0] led;
integer i;
top dut(.sw(sw), .led(led));
initial begin
for (i = 0; i < 256; i = i + 1) begin
sw = {8'hC3, i[7:0]}; #1
if (!(led === {8'd0, sw[6:4], 1'b0, sw[3:0] ^ 4'hA})) begin $display("FAIL: package constants (sw=%h led=%h)", sw, led); $finish; end
end
$display("PASS"); $finish;
end
endmodule
previous: the same package with import pkg::*; at file level, using an imported typedef
next: import in the module header: module top import pkg::*; (...)