- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if its a sine wave or other mathmatical function, why not write a function for it/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DSP Builder is a nice tool for this. It automatically converts Matlab stimuli to separate input files and generates the Modelsim testbench.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- 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?

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page