Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16597 Discussions

How to use MACRO on altera modelsim

SHung4
Beginner
2,725 Views

I add a MACRO on Setting-compiler setting-Verilog HDL input, and it works.

But when I run RTL sim by altera modelsim, it seem that it don't use the MACRO. What is the right way to use MACRO on altera modelsim, thanks.

0 Kudos
5 Replies
AnandRaj_S_Intel
Employee
1,775 Views

Hi,

 

In the Transcript window

->do <file name >.do

Will run the macro.

 

For more information refer below links

https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/ug/ug_gs_msa_qii.pdf

http://home.eng.iastate.edu/~zzhang/courses/cpre581-f05/resources/modelsim.pdf

 

Let me know if this has helped resolve the issue you are facing or if you need any further assistance.

 

Best Regards,

Anand Raj Shankar

(This message was posted on behalf of Intel Corporation)

 

0 Kudos
SHung4
Beginner
1,775 Views

I write the code in verilog file like this:

----

`ifdef FPGA

.....

`endif​

----

And I can use Setting-compiler setting-Verilog HDL input to add a macro FPGA when synthesis.

 

But I find that it don't work when run RTL-simulation.

0 Kudos
AnandRaj_S_Intel
Employee
1,775 Views

Hi,

 

+define+<macro_name>[=<macro_text>]

 

I have used simple example

########################CODE##########################

module and_op (a, b, c);

output a;

input b, c;

`ifdef behavioral

 

wire a = b & c;

`else

or a1 (a,b,c);

`endif

endmodule

##########################CODE####################

​vlog +define+behavioral -work work and_op.v

 

Let me know if this has helped resolve the issue you are facing or if you need any further assistance.

 

Best Regards,

Anand Raj Shankar

(This message was posted on behalf of Intel Corporation)

  

MACROmodelsim.png

0 Kudos
SHung4
Beginner
1,775 Views

Is there any method to add some setting on Quartus, so that I can push "Tools/Run Simulation/RTL Simulation" to run simulation?

0 Kudos
AnandRaj_S_Intel
Employee
1,776 Views

Hi,

 

Yes,

We can have simple .do script to set the simulation environment(macro enabled).

To launch simulation from Quartus.

Assignments->settings->EDA tool Settings->simulation->tool name Modelsim-Altera ->select the option "script to compile test bench" -> input the .do with the macro which you want enable.

 

To run the simulation from Quartus

Tools->Run Simulation Tools->RTL Simulations.

 

Refer image for more information.

I have used about code with simple .do file .

------------.do---------------

vlog +define+behavioral -work work C:/......./macro/and_op.v

------------------------------

Which will launch Modelsim and run simulation for the enabled macro.

 

Let me know if this has helped resolve the issue you are facing or if you need any further assistance.

 

Best Regards,

Anand Raj Shankar

(This message was posted on behalf of Intel Corporation)macroQuartusModelsim.png

0 Kudos
Reply