Home

Math2mat User Manual HES-SO // Isys project Partners: HEIG

image

Contents

1. IEZ USB y HUB SDCard bus microSD UART VLIO Memory bus Spartan XC3S5000 UART MicroMatch SRAM Audio Touchscreen PC IV Send input data O 0 N OA A Through the GUI menus the following actions can be launched Figure 6 Schematics of a ubidule Connect to a remote server that runs on the ubidule Send the bitstream to the server Retrieve output data Compare the calculation output to the expected ones e The menu Tools Ubidule test Launch entire ubidule process launches this entire process Math2mat User Manual QHES SO ISYS 3 8 External tools 17 e The menu Tools gt Ubidule test gt Launch ubidule files generation launches steps 1 to 4 e The menu Tools Ubidule test Launch ubidule verification launches steps 5 to 9 The VHDL files for the ubidule implementation are generated in src_VHDL M2M_Test while the scripts are generated in ubidule 3 8 External tools As many different tools are required for the different actions the software can per form a dialog allows to specify some information about these tools as shown in figure External tools configuration Octave path octave Browse Vsim path opt questasim bin vsim Browse Xilinx ISE path opt Xxilinx 12 2 ISE_DS ISE bin lin Browse Dot path dot Browse Simulation file
2. Successful Unsuccessful M2M_WARNING 0 M2M WARNING 0 M2M_ERROR 0 M2M ERROR 1000 M2M_FATAL 0 M2M_FATAL 0 If by any unlucky day the simulation does not go well then QuestaSim can be used with its graphical interface The user only needs to go to the sim directory and to launch the script simulation do 3 7 Ubidule tests Simulation allows to trust the generated files in terms of functionality There are garanties that the VHDL description is synthesizable and tests with real hardware can be done For this purpose the software can validate the description using a ubidule cf figure 5 This feature requires a ubidule to be set up with a server running It is therefore not available to all users at any time A ubidule embeds an ARM processor running embedded Linux and a Xilinx Spar tan3 as shown on figure 6l In this context Math2mat can automatically perform validation on the real hardware by performing the following actions 1 Generate VHDL files that instantiate the mathematical function and adds ev erything needed to work on the board 2 Generate scripts for launching the Xilinx tools 3 Launch Xilinx ISE for synthesis placement and routing 4 Launch Xilinx Impact for generating the bitstream Math2mat User Manual QHES SO ISYS 16 3 USER S GUIDE Figure 5 Picture of a ubidule board top and bottom Ethernet USB Conn USB Conn USB Conn USB Conn USB Conn
3. Simulation settings can be chosen through the menu Configure Simulation It opens a tab in which the settings can be entered Figure lillustrates this view The following settings can be chosen e The calculation precision defines how error calculations are detected It corre sponds to the number of bits of the mantissa that can differ between the ex pected and the real results e The number of samples to test One sample corresponds to a single call to the function Math2mat User Manual QHES SO ISYS 3 USER S GUIDE Q Simulation properties Data format Calculation Precision 9 Rating and sampling Number of samples 6000 System frequency 100 0 MHz Input frequency 100 0 MHz Output frequency 100 0 MHz Inactivity timeout 10000 Clock cycles Apply Figure 4 Simulation settings tab e The system frequency is the frequency at which the system should work e The input frequency corresponds to the rate at which input data should be ap plied to the system e The output frequency corresponds to the rate at which output data should be retrieved e The period of inactivity allows to automatically end the simulation if no activity is detected on the output for a certain number of clock cycles The three frequencies are used in order to more or less stress the system For each input of the system each input variable a valid input is applied at a random rate with probability frequency AITA For each o
4. 3 1 1 Empty project creation The creation of an empty project can be triggered through menu File Create empty project In that case a template m file is generated and contains the following code lt FileName gt m o Here is a simple function that adds two numbers Feel free to modify it o function s lt FileName gt a b s a b endfunction Where lt FileName gt is the name of the project 3 1 2 Project creation from m The creation of a project from an existing m file allows the user to select the name of the project and then the m file to import The m file is copied into the project directory and so the original one won t be modified by Math2mat 3 1 3 Folder validation There is a possibility to launch the validation on a folder by selecting Tools Validate projects It recursively open every project found in the hierarchy and launch the full verification process on the projects At the end a report in the console view indicates if errors were found 3 2 Folders structure During the creation of a new Math2mat project a folder with the name m2m_ lt funcName gt is created in the same directory as the project file lt funcName gt is the function name Inside this folder a couple of other folders are created Math2mat User Manual QHES SO ISYS 3 USER S GUIDE m2m_ lt funcName gt emo ern Contains the reports from simulation sr VDD gegen Contains all the V
5. 7 e Linux Ubuntu 10 10 VHDL code can be generated without additional software The software allows to view the internal representation of the structure that will lead to the VHDL generation This view far from being user friendly can be useful for developers and is generated using dot This software can be downloaded from http www graphviz org 2 1 Simulation For validating the generated files Octave and QuestaSim are required Octave is an open source software closely related to Matlab as the accepted syntax is the almost the same Octave can be downloaded from http www gnu org software octave QuestaSim is an HDL simulator provided by MentorGraphics It allows simula tion of SystemVerilog designs and testbenches It can be purchased from http www mentor com Math2mat has been validated with QuestaSim versions e 6 5 e 6 6 Tests were run with these versions but the system should work with further ver sions of QuestaSim Previous versions of QuestaSim are not supported as they do not fully accept SystemVerilog constructs One of OVM or UVM methodology is also required for correct simulation of the testbench The files of the methodology are supplied by Math2mat but the simulator needs to support these features Please not that for Linux users dot and Octave can usually installed with the help of the software manager Math2mat User Manual QHES SO ISYS 3 USER S GUIDE 2 2 Ubidule tests Math2m
6. dialog that displays the version number as well as the way to to contact the developing team and some information about Math2mat Key assist Allow the user to view the shortcut keys Math2mat User Manual QHES SO ISYS
7. then else structure Math2mat User Manual QHES SO ISYS 3 3 Mathematical grammar 9 example02 m function s example02 a b if a lt b S ax2 bx3 else S ax2 bx3 end endfunction The following code illustrates a function with 2 inputs and 2 outputs as well as a for loop example03 m function s1 s2 example03 a b sl 0 for i 1 1 10 sl slta end s2 sl bx4 endfunction 3 3 1 EBNF Here is the complete EBNF syntax supported by the parser entry pramga function affect ident tab_ind expr_lvl1 body instruction cmp_op mea Mee Me i ee tt ee ir Se expr_lvl1 expr_lvi2 expr_lvl2 expr_lvl2 expr_lvl3 7 expr_lvl3 expr_lvl13 expr_lvl4 expr_lvl4 expr_lvl4 expr_lvl5 expr_lvl5 expr_lvl5 func_var x 5 func_var expr_lvl1 func_param func_var func_var func_var ident func_param number L J number number function function_begin body function_end function_begin function ident ident ident ident param function_end end function ident endfunction ifthenelse n if logexpr the
8. 4441111 P 044444444 Y Math2mat User Manual HES SO Isys project Partners HEIG VD hepia EIA FR HES SO VS HE Arc User manual of Math2mat GUI Version 1 0 Date of issue February 2011 Report originator Yann Thoma HEIG VD Revision history Version Date Description 10 16 02 2011 First draft Math2mat User Manual QHES SO ISYS CONTENTS Contents 4 1 1 Convento 4 5 De A A ee we See ee 5 22 Ubid le ei ee aha A RI aa 6 6 3 1 Project management zu a wh eG a ab so ae nr ar 7 3 1 1 Empty project creation IIA 7 ee ee ee ee AN 7 Case ek Rak Gs a Bae a 7 ao ee eee eee a eee a 7 AAA 8 AE E E 9 BA MIR 10 B41 Editorii AAA III 10 Aa a A A 11 A E 12 4 5 BA O ee ne ar 12 3 9 C de g n ration a eed oie as am a See aaiae a Aat aa ge 1 13 a oe goes a a ae ee a eae ee 13 3 6 1 Reference generation 2 0 0 0 0 000000000 14 aaa ee ey re ee 15 3 7 Ubidule tests ir cw 08 wen AD SR a eR Ee a 15 3 85 External tools 2 io 0 wu 0 a 17 Tutorial 18 Commands 19 neh eh od Gh ee ee hae eho hae 19 5 2 Menu Edit u 8 22 200 See RE Oe ERE REE RE OS 20 ain re Sar Goss Ge od AS Ae re 21 CE AAN 22 AAA a dada e Keen Sede ey 23 A 225 2 asus KE a aa ai paper 24 Math2mat User Manual QHES SO ISYS 1 INTRODUCTION 1 Introduction The aim of the Math2mat software is to automatically generate a VHDL description of amathematical functi
9. HDL files generated by the software wrappers Contains generic wrappers for the generated system M2M Test Contains VHDL files for the ubidule implementation rare SOV ae Contains all the SystemVerilog files generated for the simulation LEO ana Contains modified OVM source files ovm_original Contains original OVM source files EUA ation ec Contains original UVM source files SFO LMZ Bestes Contains the Octave source file psr O OGE is Contains all the other Octave files needed for generat ing the reference outputs PSIM rer Contains the script that will be executed by QuestaSim A for the simulation COND its ls Will contain the compiled simulation files LO TLEISS sssi Will contain the input and expected output data files generated by Octave ae er Contains the files needed for testing the system on a real ubidule hardware 3 3 Mathematical grammar The source file of a Math2mat project consists in a file that must conform to the Octave language To date the parser accept a subset of the language e Calculus operator V x e Logical operator and or lt gt lt gt e Loop for e Conditional structure if then else elseif A function accepts any number of inputs and outputs The following code illustrates a simple function with 2 inputs and 1 output example01 m function s example0l1l a b S ax2 S Sumo endfunction The following code illustrates the if
10. at allows to automatically generate a bitstream for a Xilinx Spartan3 embed ded on a board called ubidule The automatic bitstream creation requires Xilinx ISE to be installed Tests have been conducted with version 12 2 but further versions should work ISE can be retrieved by visiting the Xilinx website http www xilinx com 3 User s guide Math2mat provides a graphical interface as show in figure 1 Command line opera tions using a subset of the Java classes are also possible and are documented in the developer guide Math2Mat 1 Function s ad a b 2 if a lt b a b 3 s a b b 4 else S s a b b 6 end 7 endfunction O Property X 0 0 view X Name Prototype Polynome M 32 bits architecture M 64 bits architecture O console X Parsing succesfull Figure 1 Math2mat graphical interface Math2mat User Manual QHES SO ISYS 3 1 Project management 7 3 1 Project management A Math2mat project consists in a m file that contains the mathematical source code and in a certain number of parameters A project file has the extension m2m and contains a XML description of the entire project This only file describing the entire project the m file is automatically regenerated by the tool if it is missing Standard Open Save and Save as commands allow to open and save the project Creation of a project can be executed in two ways Through an empty project or by importing a m file
11. g the editor in which the mathematical code has to be written From this code a flat tree view allows to visualize the internal representation of the function and a dynamic view presents the hardware structure that can be generated 3 4 1 Editor A text editor allows to edit the mathematical code It highlights the text following the Octave syntax The editor executes a live parsing every time the user modifies the text The error messages are displayed at the bottom of the main view and allow to rapidly verify the code Moreover if the dynamic view is shown then the content of this view is dynamically modified if the code corresponds to a correct syntax Using the Edit menu the following actions can be processed on the text e Execute Undo Redo actions e Cut the selected text and put it into the clipboard Copy the selected text and put it into the clipboard Paste the content of the clipboard Delete the selected text Select the entire text Toggle the comments on the selected text Comment and uncomment the selected text Math2mat User Manual QHES SO ISYS 3 4 Views 3 4 2 Dynamic view The dynamic view corresponding to the source code can be shown by selecting the menu View Dynamic view It then contains a graphical description of the hard ware that will be generated This view is dynamically regenerated every time the source code changes i e every time the code is valid Through this view moving the po
12. iew Section page 11 Show the dynmic view corresponding to the mathematical code Clear the console Math2mat User Manual QHES SO ISYS 22 5 COMMANDS Simply clear the console view 5 4 Tools Generate VHDL Section 3 5 page 13 Generate the VHDL files corresponding to the Octave code Launch test generation with Octave Section page 14 Generate the input output data files by launching Octave Launch Verification Section pagel13 Start the verification using QuestaSim It requires the VHDL and the input output files to be up to date Run all Section 3 6 page 13 Run the entire flow VHDL generation input output files generation and simula tion Test regenerated Octave code Section pagel15 This command allows to verify that the regenerated Octave code executes the same functionality as the original one Validate Projects Section pagel7 Allow to recursively validate all the projects found in a directory Launch ubidule files generation Section B 7 pagel15 Launch the ubidule files generation 1 Generate VHDL files that instantiate the mathematical function and adds ev erything needed to work on the board 2 Generate scripts for launching the Xilinx tools 3 Launch Xilinx ISE for synthesis placement and routing 4 Launch Xilinx Impact for generating the bitst
13. inter on the graphical objects displays their prop erties in the Properties view The following code will create the view presented in figure function s test a b c if a gt b SIP y else s 9 28 end endfunction O Property X Name s_m2m_1 Monitor mode Figure 2 Dynamic view showing the hardware structure Different properties are displayed and can potentially be changed depending on the kind of object View outside function The type of floating point operations can be chosen 32 or 64 bits Red square A red square represents an internal signal It can be monitored or not If checked then the state of this signal is verified during simulation Operator An operator is a basic block that performs computation Different imple mentations are proposed and can be chosen by the user When selecting a block Math2mat User Manual QHES SO ISYS 12 3 USER S GUIDE it is also possible to apply this change to all operators executing the same com putation Multiplexer A multiplexer is used when if then else statements are present in the source code Putting the pointer on a multiplexer highlights in blue the sig nals necessary for the condition calculation It is also possible to monitor the condition of the multiplexer For increment In a for loop block the increment is represented by a rectangle 3 4 3 Flat tree view Math2mat offers the possibility to view the state of the internal structure This str
14. ion up to 6 5 or from 6 6 different SystemVerilog code is generated in order to attain internal signals in the VHDL hierarchy The last two fields are required for the ubidule tests The license for the Xilinx tools has to be specified as well as the IP address of the ubidule on which the testing server is running 4 Tutorial This tutorial shows you the steps required to create a new project generate the VHDL code and simulate it If something goes wrong with the steps it is probably because Math2mat does not find the external tools In that case messages should appear and you ll be able to specify their location with the menu Configure External tools So here are the steps 1 Select the menu File New empty project 2 In the dialog choose the name of the project You should create it in an empty directory as it will be populated with the directories of Math2mat 3 The new file contains a function that performs an addition 4 Open the dynamic view View Show dynamic view to observe the kind of digital system that will be generated 5 Feel free to modify the function but at least you can start with the simple adder 6 To generate the files and simulate them select the menu Tools Run all or click on the gt icon 7 And there you are Too simple no 8 Add a little bit of complexity to the function making it look like this Math2mat User Manual QHES SO ISYS lt FileName gt m f
15. n body elseif logexpr body else body end endif ident char digit char _ instruction affect loop ifthenelse op_switch not_instruction_cmd logexpr logterm log_op logexpr logterm logfactor cmp_op logterm logfactor 7 func_var logexpr log_op or and loop loop_begin body end endfor loop_begin for ident func_var func_var func_var not_instruction_cmd printf error any_string number digit digit digit digit Math2mat User Manual QHES SO ISYS 10 3 USER S GUIDE op_switch switch func_var case func_var func_var func_var body otherwise body end param ident ident pragma Ym2m ident ident tab_ind number char ee tar b CG d le EI tg h ij 2 k cales m n o p or or s tr I url ty w x y dede A B Gt D E F G H dl 2 K E M N oO pe QO R S Broil PUES v W xX AY wa digit oe TO 1 fo 3 A 157 6 7 8 9 3 4 Views Different views are proposed to the user the main one bein
16. on using floating point operators It also generates a full Sys temVerilog testbench that allows to validate the hardware description by comparing it to the initial mathematical description The initial description corresponds to the Matlab Octave syntax and allow operations such as addition subtraction multipli cation division and structures such as if then else and for loops The main features of Math2mat are Editor for typing Octave code e Dynamic code analysis during typing Generation of synthesizable VHDL code Floating point operations SystemVerilog testbench generation Fully automated test suite for the generated code Graphical interface with internal structure viewing As the software is still under development don t hesitate to submit a wish on the Wiki page of Math2mat http www tobecompleted org 1 1 Conventions The following conventions apply in this manual e Octave code is presented in this format e VHDL code is presented int this format Menu selection is shown This Way e Files and folders are shown like this File content is shown in a box that also highlights the filename filename ext Various source code And more Math2mat User Manual QHES SO ISYS 2 Requirements Math2mat has been developped in Java with the Eclipse framework The release should be self contained and should run on Windows and Linux The following systems have been tested e Windows XP e Windows
17. ream Math2mat User Manual QHES SO ISYS 5 5 Configure Launch ubidule verification Section 3 7 page 15 Launch the ubidule verification taking into account that the files have been previ ously generated 1 Connect to a remote server that runs on the ubidule 2 Send the bitstream to the server 3 Send input data 4 5 Retrieve output data Compare the calculation output to the expected ones Launch entire ubidule process Section B 7 page 15 Launch the entire ubidule test process 1 OO oo N 0 70 gt QU N 5 5 Generate VHDL files that instantiate the mathematical function and adds ev erything needed to work on the board Generate scripts for launching the Xilinx tools Launch Xilinx ISE for synthesis placement and routing Launch Xilinx Impact for generating the bitstream Connect to a remote server that runs on the ubidule Send the bitstream to the server Send input data Retrieve output data Compare the calculation output to the expected ones Configure External tools SectionB sl pagel17 Configure the external tools properties Simulation Section 3 6 page 13 Modify the settings for the simulation Optimization Section B 5 page 13 Modify the settings for the optimization Math2mat User Manual QHES SO ISYS 24 5 COMMANDS 5 6 Help About Math2mat A standard About
18. s Original UVM v Simulator Questa_v6 5 v Xilinx license 2100 eint09 Ubidule IP 10 192 51 40 OK Cancel Figure 7 External tools properties dialog As already mentioned no external tool is required to simply generate a VHDL de scription Octave and QuestaSim needs to be accessible for verification Xilinx ISE only for ubidule tests and dot for visualizing the internal structure For these four tools by default their name is proposed by Math2mat If they are not accessible through the path then the user can specifiy the location of the executable as shown in figure for Vsim the executable for QuestaSim For ISE only the directory where ISE is installed should be set not the executable itself Two combo boxes allow to specify general settings for the simulation The simulation files lets the user choose to use OVM UVM or modified OVM files The only changes Math2mat User Manual QHES SO ISYS 18 4 TUTORIAL during simulation are the way messages are displayed in the console The prefix will be Simulation files Prefix OVM M2M ERROR 0 Original OVM OVM_ERROR 0 Original UVM UVM_ERROR 0 If the user needs to perform simulation using the QuestaSim Gui by executing the script sim simulation do then it is better to use the original options as the errors will be identified by QuestaSim The simulator allows to specify what version of QuestaSim is installed on the com puter Depending on the vers
19. t project file Save Section B 1l page Save the current project as well as the m file Save as Section 1 pagel7 Save with a new name the current project Exit Quit the application 5 2 Menu Edit Undo Section 3 4 1 page Undo the last action Redo Section B 4 1 pagel10 Redo the actions that have been undone Cu en Section page Cut the selected text and put it into the clipboard Copy Section 3 4 1 page 10 Math2mat User Manual QHES SO ISYS 5 3 View Copy the selected text into the clipboard Paste Section 3 4 1 page Paste the content of the clipboard into the text editor Delete Section B 4 1 page Delete the selected text Select all Section 3 4 1 page 10 Select the whole text of the current editor Toggle comment Section 3 4 1 page 10 Toogle the comments for the selected lines Comment Section 3 4 1 page Comment the selected lines Uncomment Section 3 4 1 page Uncomment the selected lines 5 3 View Show the flat view Section 3 4 3 pagel12 Show the flat view of the internal structure in the form of a png file loaded in the GUI Show the tree view Section 3 4 3 pagel12 Show the tree view of the internal structure in the form of a png file loaded in the GUI Show the dynamic v
20. tave code generation Messages about what files are created Simulation Messages retrieved from QuestaSim e Ubidule testing Messages showing what happens during the synthesis place ment routing processes and during the test on the real hardware Always Potential internal errors 3 5 Code generation Code generation can be executed by selecting the menu Tools Generate VHDL The VHDL files are put in src_VHDL The description of the files structure and implementation can be found in another document 3 6 Verification Math2mat being able to generate VHDL code checking that this code really does what it should allows to better trust the tool For this purpose simulation can be automatically launched in order to verify the generated system functionality The testbench is generated in the folder src_SV and is composed of SystemVerilog files QuestaSim is required for the simulation of these SystemVerilog files and is launched by Math2mat The Configure gt External Tools menu allows to specifiy where the vsim executable is located in case it is not accessible through the common path search As Octave is also required to generate reference date files it should also been reached by the common path or located through the same menu The verification is done in two phases 1 Firstly reference data are generated by Octave 2 Secondly SystemVerilog takes advantage of the references to simulate and ver ify the system behavior
21. uc ture is created during the code parsing and is then manipulated in order to prepare the VHDL code generation A standard user should note really need to open this view letting this to developers The tree view corresponds to the state of the struc ture after parsing while the flat one represents its state before code generation These view requires dot software to be installed cf section page 5 Math2mat generates a dot file called fname_flat dot or fname_tree dot that is then pro cessed by dot to create a png file called fname_flat png or fname_tree png This last file is then open by Math2mat The dot and png files can be found in the src_m2m folder Figure Blillustrates the schematics corresponding to the flat view of the following code adder m function s adder a b s a b endfunction b b m2mo a mamo a_m2m_0 b_m2m_0 m2m_0 s_m2m_0 s Figure 3 Internal structure corresponding to the operation s a b As the schematics generated can be very big it is often easier to open them using a traditional image viewer instead of using Math2mat 3 4 4 Messages view At the bottom of the graphical interface a message view corresponding to a console displays useful information in order to let the user know what happens This information depends on the type of processing the software is doing Math2mat User Manual QHES SO ISYS 3 5 Code generation Editing Compilation errors or warnings Oc
22. unction s lt FileName gt a b s axbtb endfunction The dynamic view should now look like this O View amp m 9 Move the pointer onto different places of the dynamic view You can observe the properties of the objects 10 Click on one of the red squares and select Monitor mode in the property view It will then monitor this signal during the next simulation 11 Click on the gt icon to generate and simulate the new design 5 Commands This section lists all the commands accessible from the different menus A reference allows to rapidly go to the section in which more details about the command can be found 5 1 Menu File File New empty project Section page Create a new empty project The user is asked to choose a directory and a name for the project The m file is automatically created and corresponds to the name of the project A function template is also written into the file in order the names to match This function is Math2mat User Manual QHES SO ISYS 20 5 COMMANDS lt FileName gt m Here is a simple function that adds two numbers Feel free to modify it function s lt FileName gt a b s a b endfunction Where lt FileName gt is the name of the project Create new project from m file Section page Create a project with an initial source code file copied from an existing one Open Section B 1 pagel7 Open a Math2ma
23. utput of the system each output variable output frequency system frequency The new settings are set when pressing on the Apply button and will also be stored in the project file a ready signal is applied at a random rate with probability 3 6 1 Reference generation Octave is used to generated files describing the inputs and files in which the ref erence output values are stored All these files are stored in sim iofiles and have names being file_input1 dat file_input2 dat for the input and file_outputl dat file_output2 dat for the ouptut The number corresponds Math2mat User Manual QHES SO ISYS 3 7 Ubidule tests 15 em to the place of the input output in the Octave source code The calculation is per formed using the source file edited in the Math2mat editor However if internal variables have to be monitored then the octave file is regenerated in order to create data files for the internal variables In that case the menu Tools Test regenerated Octave code allows to validate the regenerated code ensuring that its functionality is the same as the original file 3 6 2 Simulation Simulation is handled by QuestaSim QuestaSim is launched in batch mode and exe cutes the script that was previously generated sim simulation do The output of the simulation is displayed in the console view the end of the message allowing to observe if the simulation went well or not The last lines look like this

Download Pdf Manuals

image

Related Search

Related Contents

Bedienungsanleitung - CS  802.11g Wireless USB 2.0 Adapter WL-U356R User`s Manual  Steelseries QcK mini  “ やめない ”社員 を育てる  HP B6960-90078 User's Manual  EN - NL  Junkers-Ceramini-ZSN-11-7-KE-Installation-und  Garmin Vector S Quick Start Manual  CS610 Series  

Copyright © All rights reserved.
Failed to retrieve file