Skip to content

Renaming modules programatically #636

Answered by quark17
iamkarthikbk asked this question in Q&A
Discussion options

You must be logged in to vote

I don't understand your concern about consumed macros. It sounded like you had a module like the following very simple example:

(* synthesize *)
module mk_abc (...);
   ...
   Reg#(Bit#(16)) rg <- mkReg( `INIT_VALUE );
   ...
endmodule

And you can compile it by providing a specific value for the macro:

bsc  -verilog  -D INIT_VALUE=1  ABC.bsv

This would generate a Verilog file mk_abc.v, containing a module that had 1 as the initial value for the register.

But you want to generate three different versions of this module:

bsc  -verilog  -D INIT_VALUE=1  ABC.bsv
bsc  -verilog  -D INIT_VALUE=2  ABC.bsv
bsc  -verilog  -D INIT_VALUE=3  ABC.bsv

but each time it will overwrite the existing mk_a…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@iamkarthikbk
Comment options

@quark17
Comment options

Answer selected by iamkarthikbk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants