mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-03 01:40:23 +00:00
Added support for macro arguments
This commit is contained in:
parent
09bd82db21
commit
921064c200
2 changed files with 84 additions and 23 deletions
9
tests/simple/macros.v
Normal file
9
tests/simple/macros.v
Normal file
|
@ -0,0 +1,9 @@
|
|||
module test(a, y);
|
||||
`define MSB_LSB_SEP :
|
||||
`define get_msb(off, len) ((off)+(len)-1)
|
||||
`define get_lsb(off, len) (off)
|
||||
`define sel_bits(offset, len) `get_msb(offset, len) `MSB_LSB_SEP `get_lsb(offset, len)
|
||||
input [31:0] a;
|
||||
output [7:0] y;
|
||||
assign y = a[`sel_bits(16, 8)];
|
||||
endmodule
|
Loading…
Add table
Add a link
Reference in a new issue