hdl code generation using matlab/simulink
DESCRIPTION
HDL Code Generation using MATLAB/Simulink. Milica Ristović, Slobodan Lubura University of East Sarajevo, Faculty of Electrical Engineering . Verilog i HDL codes can be generated from one of these models: - Simulink model; - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/1.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 1 -
DAAD
HDL Code Generation using MATLAB/Simulink
Milica Ristović, Slobodan Lubura
University of East Sarajevo, Faculty of Electrical Engineering
![Page 2: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/2.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 2 -
DAAD
Verilog i HDL codes can be generated from one of these models:
- Simulink model;
-Stateflow diagram;
-Embedded MATLAB model.
![Page 3: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/3.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 3 -
DAAD
Steps which are neccessary for HDL Code generation in Simulink:
1. Design HDL compatible Simulink model;
2. Data type conversion from floating-point to fixed-point;
3. Use tool for compatibility check (it leads to eventual errors or problems, made durring generation);
4. HDL Code Generation;
5. Analyze of Generated HDL Code;
6. Implementation of Code on FPGA board or another similar device, analyze of device.
![Page 4: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/4.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 4 -
DAAD
Fixed-point
• Application “Simulink Fixed-point” expands possibilities of Simulink environment and enables using Data types in fixed-point format.
• Data Type Conversion fixdt(x,y,z), where x is number of bits, y number of bits of real part, and z number of bits of fractional part.
![Page 5: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/5.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 5 -
DAAD
Panel “HDL Code Generation“
![Page 6: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/6.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 6 -
DAAD
Compatibility check with HDL Coder
1) Using „HDL Code Generation“ panel: Choosing „Run Compatibility Checker“;
2) Right click on subsystem which HDL Code is going to be generated,
choosing HDL Code Generation Check Subsystem Compatibility;
3) Writing command in command window: >> checkhdl (‘Name_of_model', ‘Name_of_subsystem');
If model is not COMPLETELY compatible with HDL Coder, code generation will not be done!
![Page 7: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/7.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 7 -
DAAD
HDL Code Generation
1) Using „HDL Code Generation“ panel: Choosing „Generate“; 2) Right click on subsystem which HDL Code is going to be generated, choosing
HDL Code Generation Generate HDL for Subsystem;
3) Writing command in command window: >> makehdl (‘Name_of_model', ‘Name_of_subsystem');
Message: # # # HDL Code Generation Complete means end of proccess of HDL Code Generation.
![Page 8: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/8.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 8 -
DAAD
Report of generated HDL code
Report has some parts from which we can get these information:
information about version of HDL Code, and creating date;
insight in virtual blocks, which cannot be seen in the model, unlike of real blocks (Simulink blocks), giving us mapping between elements (blocks and subsystems) of model and code: Code–model links, clicking them we can see part of subsystem or block that
is cide generated for; Model–code links, enable to see generated code for any block in the model.
( HDL Code Generation Navigate to Code )
![Page 9: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/9.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 9 -
DAAD
Implementation of CORDIC Algorithm on FPGA Altera Cyclone II
- Coordinate Rotation DIgital Computer - taken from Simulink demos models – adaptation is neccessary
![Page 10: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/10.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 10 -
DAAD
Implementation of CORDIC Algorithm on FPGA Altera Cyclone II
Adapted CORDIC model:
![Page 11: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/11.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 11 -
DAAD
Implementation of CORDIC Algorithm on FPGA Altera Cyclone II
CORDIC Algorithm model in Quartus:
![Page 12: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/12.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 12 -
DAAD
Implementation of CORDIC Algorithm on FPGA Altera Cyclone II
Waveforms used for testing CORDIC Algorithm in Quartus:
![Page 13: HDL Code Generation using MATLAB/Simulink](https://reader033.vdocuments.site/reader033/viewer/2022061510/56816203550346895dd2280d/html5/thumbnails/13.jpg)
Projekt „ESSNBS“
Niš, November 4th – 7th, 2012 - 13 -
DAAD
Thank you for attention!!!