matlab to vhdl

31
Matlab to VHDL Code Conversion A Tutorial by: http://appliedelectronicsengineering.blogspot.com VHDL

Upload: sumalama

Post on 16-Jul-2015

104 views

Category:

Engineering


4 download

TRANSCRIPT

Page 1: Matlab to vhdl

Matlab to VHDL

Code Conversion

A Tutorial by:

http://appliedelectronicsengineering.blogspot.com

VHDL

Page 2: Matlab to vhdl

Introduction

In this tutorial we show how a to write a

Matlab function code and covert it to a VHDL

code. We will write a simple multiplexer

code for the purpose of illustration.

Send Feedback to: http://appliedelectronicsengineering.blogspot.com

Page 3: Matlab to vhdl

• Create a new Project in Matlab and create a Function File named mux_func(a,b,sel)

• Save the function file with name mux_func.m

Step1: Create a Function File

http://appliedelectronicsengineering.blogspot.com

Page 4: Matlab to vhdl

• Create another script file enter the code as shown

• Save the script file with some name like test.m

• This script file is used to test the function mux_func that was created earlier

Step 2: Create a script file

http://appliedelectronicsengineering.blogspot.com

Page 5: Matlab to vhdl

• Run the test file to ensure that the function works as intended

• To do this just click on the Run button in the Editor tab

Step 3: Run the Test file

Run Editor

Tab

http://appliedelectronicsengineering.blogspot.com

Page 6: Matlab to vhdl

Select the APPS tab and click on the HDL Coder

Step 4: Select HDL Coder

Page 7: Matlab to vhdl

Step 5: Specify Project Name to your

HDL Code Project

Once you click the HDL coder in step 4 a window will pop up just like the one below where you can specify a project name for you HDL coder project with the name of your choosing. In this case mux_hdl was given as project name

Page 8: Matlab to vhdl

Step 6: Select File to Convert

The HDL Coder screen will open as shown

http://appliedelectronicsengineering.blogspot.com

Page 9: Matlab to vhdl

Browse for the Files

Click here to Add MATLAB function

Add the function file mux_func to convert

Page 10: Matlab to vhdl

Browse and select the mux_func function file

Page 11: Matlab to vhdl

Click on WorkFlow

Advisor

Page 12: Matlab to vhdl

Similarly add the test.m file

Page 13: Matlab to vhdl

Step 7: Convert matlab function to HDL using

Workflow Advisor

Page 14: Matlab to vhdl
Page 15: Matlab to vhdl
Page 16: Matlab to vhdl
Page 17: Matlab to vhdl
Page 18: Matlab to vhdl
Page 19: Matlab to vhdl
Page 20: Matlab to vhdl
Page 21: Matlab to vhdl
Page 22: Matlab to vhdl
Page 23: Matlab to vhdl
Page 24: Matlab to vhdl
Page 25: Matlab to vhdl
Page 26: Matlab to vhdl
Page 27: Matlab to vhdl
Page 28: Matlab to vhdl
Page 29: Matlab to vhdl
Page 30: Matlab to vhdl
Page 31: Matlab to vhdl