0
votes

I want to name a module using a `define directive

It seems to work if I use a macro like :

`define module_rename(NAME,TAG) ``NAME``TAG

module `module_rename(foo,_A) (...);

but it fails (in quartus) if I do the following :

`define NAME foo
`define TAG _A

module `NAME`TAG (...);

Syntax Error near_A missing";"

Any idea what is wrong ?

Tx for your help

1

1 Answers

0
votes

The SystemVerilog token pasting operator `` is only allowed in the body of a `define text macro, and that is the only place you can join text together to form a single identifier. The second example you wrote is seen as illegal syntax.

module foo _A;