Skip to main content

MATLAB To HDL Conversion

  Hello Dear Reader,

Here in this post, I will give an idea about how HLS(High-Level Synthesis) works. Here This kind of higher-level language to HDL conversion facility is provided by one of the famous software MATLAB. Here I have implemented a full-adder logic functionality to test the steps. So Let's see how it work.

Steps:

1) Open MATLAB

2) Write a function that you want to convert to VHDL




3) Go to Apps and search for HDL Coder

4) Open HDL Coder and make a new project





5) Add MATLAB function file




6) Click on Workflow Advisor


7) Select Convert to fixed-point at build time because double operation is not suitable for FPGA



8) Define input types




9) Go to Fixed-point conversion and define Static Min and Static Max
10) Go to Data collection and Compute Derived Ranges
 



11) Select Code Generation Target


12) HDL Code Generation
   Select VHDL as an HDL format for RTL conversion. And the last step is to press the run menu which is situated middle of the right side.


13) VHDL Code
   Here below is the VHDL code which is obtained from the above steps which say our steps are successfully implemented.

LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;

ENTITY full_adder_fixpt IS
  PORT( a                                 :   IN    std_logic;
        b                                 :   IN    std_logic;
        c                                 :   IN    std_logic;
        carry                             :   OUT   std_logic;
        sum                               :   OUT   std_logic
        );
END full_adder_fixpt;


ARCHITECTURE rtl OF full_adder_fixpt IS

BEGIN
  --HDL code generation from MATLAB function: full_adder_fixpt
  --%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  --                                                                          %
  --           Generated by MATLAB 9.4 and Fixed-Point Designer 6.1           %
  --                                                                          %
  --%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  sum <= ((((( NOT a) AND ( NOT b)) AND c) OR ((( NOT a) AND b) AND ( NOT c))) OR ((a AND ( NOT b)) AND ( NOT c))) OR ((a AND b) AND c);
  carry <= ((a AND b) OR (b AND c)) OR (a AND c);

END rtl;

 














 

Comments

  1. Superb easy explanation for this awaiting topic.

    ReplyDelete
  2. Completed sir this steps best learning thanks for your efforts.

    ReplyDelete
  3. First ever I found this solution

    ReplyDelete

Post a Comment

Popular posts from this blog

Tutorial on EasyEDA desktop software for PCB and schematic design

In this article, I am going to write a tutorial on how to use EasyEDA desktop application for creating a schematic and for PCB design. One of best advantage of this software is that you can create design offline and can automatically synchronize your design with your online EasyEDA account.  It can be used for circuits simulation, PCB deign and electronics circuits design. You can download EasyEDA desktop application by clicking on following link and it will work on windows 7 or its greater version. They are also releasing soon offline application OSX and Linux users. So keep visiting their website for more information.                                                    https://easyeda.com/page/download So let’s start and see how to design a schematic and PCB using EasyEDA offline desktop application. So first of all lets see how to create a schema...

What is Solar System Components & Installation Guide

Hello Dear Reader, Here in this post, I will give an idea about installation cost analysis of Solar PV System. I hope you read this post regarding the calculation of solar PV system  so in this post I have given an approximate cost analysis of the different solar system installations.  What is Solar System Components Solar systems are made up of solar panels (modules), a mounting system, and a solar inverter with computerised controller. Solar panels produce DC electricity from sunlight. Then the inverter converts the generated electricity into AC, so that it can be used in the household. The computerised controller manages the solar system and ensures optimal performance. If you want a battery backup system or an off-the-grid solar system, a battery is required. What is a Solar Energy System? Solar Energy System consists of 4 main components that decide the working of a solar energy system. Solar Panel Solar Inverter Solar Battery Panel Stand, and Solar Panel Installation...

CMOS OPAMP Design Using LTspice

  Hello Dear Reader, Here in this post, I will give an idea about how CMOS OPAMP designing using 180nm technology node and using LTspice. from that opamp I have design switched capacitor integrator. Design Specifications: Here Design specification may be changed according to the application here my target is to design an active lowpass filter so I have chosen an opamp integrator so in the below I have explained how to design an opamp as well as an integrator in a 180nm technology node in LTspice. So let's start design First, we need a technology parameter file so that the file we can insert in the LTspice, in my example it is 180nm so mostly it is available from the  http://ptm.asu.edu/latest.html  and you make one text file using notepad or whatever is fit on your own. Then go to the LTspice and new schematic and then you see .op on the right most upper side click on it and give your text file path after .include  as shown in the below images.  Now first of all...