Matlab to VHDL Code Tutorial

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

description

This is a tutorial to convert matlab code to vhdl code. It is a step by step tutorial to create a function file in matlab and to convert it to VHDL code.

Transcript of Matlab to VHDL Code Tutorial

  • Matlab to VHDL

    Code Conversion

    A Tutorial by:

    http://appliedelectronicsengineering.blogspot.com

    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

  • 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

  • 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

  • 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

  • Select the APPS tab and click on the HDL Coder

    Step 4: Select HDL Coder

  • 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

  • Step 6: Select File to Convert

    The HDL Coder screen will open as shown

    http://appliedelectronicsengineering.blogspot.com

  • Browse for the Files

    Click here to Add MATLAB function

    Add the function file mux_func to convert

  • Browse and select the mux_func function file

  • Click on WorkFlow

    Advisor

  • Similarly add the test.m file

  • Step 7: Convert matlab function to HDL using

    Workflow Advisor