Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17267 Discussions

Importing data into ModelSim

Altera_Forum
Honored Contributor II
4,700 Views

Is it possible to import arbitrary data into ModelSim (Altera web version)?  

 

I would like to evaluate the frequency response of a filter. I don't see how I could generate a signal having a particular frequency within a test bench. Each test frequency would require at least 200 samples. 

 

It would be simple to do if I could read the test data from a file.
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
3,190 Views

You can either read text file or generate data stream directly in testbench. 

 

Here is example of reading text file: 

-- read input stimulus process(reset,clk) file file_in : text open read_mode is "filename.txt"; variable line_in : line; variable input_tmp : integer := 0; begin if(reset = '1')then data_in <= (others => '0'); elsif(rising_edge(clk))then if not endfile(file_in)then readline(file_in,line_in); read(line_in,input_tmp); data_in <= std_logic_vector(to_signed(input_tmp,16)); end if; end if; end process;
0 Kudos
Altera_Forum
Honored Contributor II
3,190 Views

if its a sine wave or other mathmatical function, why not write a function for it/

0 Kudos
Altera_Forum
Honored Contributor II
3,190 Views

If he's using VHDL, the ieee.math_real package has them. 

If he's using Verilog.. it's uglier, he has to use PLI or equivalent.
0 Kudos
Altera_Forum
Honored Contributor II
3,190 Views

DSP Builder is a nice tool for this. It automatically converts Matlab stimuli to separate input files and generates the Modelsim testbench.

0 Kudos
Altera_Forum
Honored Contributor II
3,190 Views

 

--- Quote Start ---  

if its a sine wave or other mathmatical function, why not write a function for it/ 

--- Quote End ---  

 

 

I'm using Verilog; is that possible. If so, how?
0 Kudos
Reply