Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

import data generated from matlab into VHDL program and then execute and get results

Status
Not open for further replies.

electronical

Advanced Member level 4
Joined
Nov 4, 2011
Messages
104
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
1,975
I need to import data generated from matlab
into VHDL program and then execute and get results exported into
matlab for further analysis.
how can I do it?
 

What do you exactly have to do? Are you trying to prepare stimuli in Matlab and then simulate the VHDL design with those? In this case, this is a general question on how to use input text files for stimuli creation, and there are already topics on this in this forum.

Cheers
 

I have a vhdl program that I want use matlab to import input to it and then the result recieved output of vhdl code export to matlab and then synt the result,I want to know how can I do it?
(I want use command window not simulink,my code is in a loop)
 

Dear electronical,

I still do not understand what you are trying to do. You have a VHDL design; this design requires some inputs, and you provide it through Matlab; then you simulate your VHDL design, store the results and go back to Matlab session to post-process the results. Is this your target? So, why you mentioned Simulink?

Cheers
 

yes.I want to do it,I want provide inputs from matlab ,...
 

Ok, so you have to use text files: prepare input from within Matlab and store those inputs to file (it's a simple Matlab script); then parse files from within VHDL and apply the stimuli in your test-bench, writing results to another output file; now, back to Matlab import results file and post-process it. If you google or search in this forum for VHDL reading/writing from/to file you will get sample code for this purpose. Just as an example

**broken link removed**

Cheers
 
thankyou,
I want this work be automatically,my code is in loop and it and Code synthesis to be continue where it achieved a result acceptable.
in theother ways I want vhdl code works seem a command that it is in a loop for,
can do it?
 
Last edited:

What you can do is to invoke the simulator for the VHDL design in batch mode, provided that the correct test bench has been defined: which simulator are you using?
 

I dont know which one is better ISE or Modelsim ,I synt my code in ISE and Modelsim
 

Modelsim seems to be much more comprehensive for functional simulation. However, you should check with both of them if it is possible to simulate them in batch mode. I know how to do it using Cadence tools, and I always used Modelsim from graphical interface :-?

Cheers
 
Do you have an article ,pdf or site about it that I get a faster answer,I search many but cant find any thing that help me
 

Actually if you google "modelsim batch mode tutorial" there are plenty of how-to for this purpose... Also, if you are under Linux, it is much easier to get info from man or info pages. Just check with the installation archive.

Cheers
 
thank you so much, can I send you emails if I have problem ?
 

I guess, the problem is missing knowledge of the VHDL textio package.

Generally ASCII formatted data files are a straightforward way to read in stimulation data. You'll read e.g. one line for each clock cycle in your testbench, and decode one or multiple values and assign it to the stimulus vector. The testbench scans the file line by line and stops when no more data can be read.
 

Here's an example that reads a single stimulus vector (representing an analog waveform) line by line. You can easily extend it to read additional values and possibly write output data to a second file.
Code:
  Process
    file IN_DAT : text open read_mode is "scope.txt";
    variable LI: line;
    variable MV: integer;
	Begin
	    while not (endfile(IN_DAT)) loop
        	    wait until rising_edge(clk);
        	    readline (IN_DAT, LI);
        	    read (LI, MV); 
        	    adc <= std_logic_vector(conv_signed(MV,12)) XOR X"800";
        end loop;
        file_close(IN_DAT);
        wait;	    
    End Process;
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top