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.

Matlab HDL Coder: How to replace "open file" function?

Status
Not open for further replies.

ali8

Member level 2
Joined
Jan 1, 2011
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,646
Hello,

I am trying to convert a Matlab code that do some communication algorithms into an HDL code, using HDL Coder.

Alongside the code I have a binary file to work on it, emulating a real-world situation where the algorithm will be working on real data coming out
of a front-end module (ADC, etc).

In Matlab, I have an
Code:
fopen
function that opens the binary file and start working on it.

Since I am converting this into HDL,
Code:
fopen
is not supported, which makes sense.

Now, how should I replace such function before converting? I was thinking about defining a variable that is "wired" to an I/O pin in the FPGA
but not sure if this makes sense or not.

Any ideas?
 

fopen would be a simulation only construct, and HDL coder is aimed at converting simulink/embedded M to synthesisable HDL. So this fopen needs to move out of the design you are trying to convert to HDL completly. You will need some interface to transfer the data into your HDL block.
 
  • Like
Reactions: ali8

    ali8

    Points: 2
    Helpful Answer Positive Rating
Do you have specific suggestion? I was thinking of defining a variable, and when getting the VHDL, modifying it such tat it is wired to an I/O....
 

Re: Matlab HDL Coder: How to replace "open file" function?

give it a go and try it - I cant see the design, so have no idea how appropriate it is. Just keep the fopen well away from HDL coder.

- - - Updated - - -

Btw, you can use HDL coder on specific parts of your Simulink design, so the rest of it exists as a testbench for the HDL (which you can then connect in with a co-simulation block). SO the fopen can stay elsewhere in the bit you dont intend to convert with HDL coder.
 
  • Like
Reactions: ali8

    ali8

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top