3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 00:55:32 +00:00

support using previously declared types/localparams/params in package

(parameters in systemverilog packages can't actually be overridden, so
allowing parameters in addition to localparams doesn't actually add any
new functionality, but it's useful to be able to use the parameter
keyword also)
This commit is contained in:
Jeff Wang 2020-04-07 00:37:44 -04:00 committed by Jeff Wang
parent ebf23cd62e
commit 249876b614
3 changed files with 33 additions and 4 deletions

View file

@ -1,6 +1,9 @@
package pkg;
typedef logic [7:0] uint8_t;
typedef enum logic [7:0] {bb=8'hBB} enum8_t;
typedef enum logic [7:0] {bb=8'hBB, cc=8'hCC} enum8_t;
localparam uint8_t PCONST = cc;
parameter uint8_t PCONST_COPY = PCONST;
endpackage
module top;
@ -8,7 +11,9 @@ module top;
(* keep *) pkg::uint8_t a = 8'hAA;
(* keep *) pkg::enum8_t b_enum = pkg::bb;
always @* assert(a == 8'hAA);
always @* assert(b_enum == 8'hBB);
always_comb assert(a == 8'hAA);
always_comb assert(b_enum == 8'hBB);
always_comb assert(pkg::PCONST == pkg::cc);
always_comb assert(pkg::PCONST_COPY == pkg::cc);
endmodule