13.07.2015 Views

An Automatic Approach to Generate Haste Code from Simulink ...

An Automatic Approach to Generate Haste Code from Simulink ...

An Automatic Approach to Generate Haste Code from Simulink ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

& sim_sum2 = proc (& Y1 ! chan VECTOR_17& A1 ? chan VECTOR_16& A2 ? chan VECTOR_16). begin& v_A1 : var VECTOR_16& v_A2 : var VECTOR_16| forever do// input acquisition( A1 ? v_A1 || A2 ? v_A2 )// output generation// (sim_sum2_f is imported); Y1 ! sim_sum2_f(.A1( v_A1 ), .A2( v_A2 ) )odendFigure 10. <strong>Haste</strong> shell for a 2-inputs adder.input and each output is listed as an input or an outputchannel respectively. In the body of the procedure onlythe interface operations are performed: inputs are read andoutputs are generated by the external function associated <strong>to</strong>the block itself. Please mind the order of execution, indeedthe inputs are collected in parallel and obviously when allof them are available, the outputs can be generated.5.2.2. Sampling Blocks. Sampling blocks can have differentimplementations synchronized with a global clock, in order<strong>to</strong> slow down the circuit operation (<strong>to</strong> make it operate ata certain Sampling Time) or completely asynchronous (seeSec. 4.2). In both modes the input data rate can differ <strong>from</strong>the output one. Using these blocks it is possible <strong>to</strong> make amulti-rate system in which the data rate is increased (usinga unit delay block) or decreased (using a zero orderhold block). Figure 11 shows the <strong>Haste</strong> description of suchblocks.5.2.3. RTL Processing Part / Parametric RTL Description.Each block has a set of parameters that can be configured<strong>to</strong> make the module able <strong>to</strong> deal with different scenarios(serial or parallel input/output representation, different datawidth,. . . ) and all these parameters can be configured inthe VHDL description. For each block a HDL file will begenerated with all the desired parameters set and an RTLCompiler script that can synthesize it in<strong>to</strong> a Verilog netlist.5.3. <strong>Simulink</strong> <strong>to</strong> <strong>Code</strong><strong>Simulink</strong> ConversionThe typical approach used <strong>to</strong> develop a design that shouldbe converted in<strong>to</strong> hardware is <strong>to</strong> build a diagram using <strong>Code</strong>-<strong>Simulink</strong> blocks <strong>from</strong> the start. The advantage of startingwith <strong>Code</strong><strong>Simulink</strong> blocks instead of <strong>Simulink</strong> blocks isthat their simulation behavior matches that of their hardwareimplementation. Since the <strong>Code</strong><strong>Simulink</strong> block set is one<strong>to</strong>-onecompatible with the standard <strong>Simulink</strong> one, we also& sim_ud = proc (& Y1 ! chan VECTOR_16& A1 ? chan VECTOR_16). begin& v_A1 : var VECTOR_16| forever do// output generation (oversampled)for 5 do ( Y1 ! v_A1 ) od// input acquisition; A1 ? v_A1odend(a)& sim_zoh = proc (& Y1 ! chan VECTOR_16& A1 ? chan VECTOR_16). begin& v_A1 : var VECTOR_16| forever do// input acquisitionfor 5 do ( A1 ? v_A1 ) od// output generation (undersampled); Y1 ! v_A1odend(b)Figure 11. <strong>Haste</strong> description of a “unit delay” 11(a) and ofa “zero order hold” 11(b) blocks both with a over- undersamplingratio of 5.provide a conversion utility which au<strong>to</strong>matically converts apure <strong>Simulink</strong> model in<strong>to</strong> a <strong>Code</strong><strong>Simulink</strong> one by settingthe parameters needed for the implementation according <strong>to</strong>the simulation results of the model.5.4. System DescriptionNow that we have introduced the structure of each blockin the design, we will explain how the whole system isdescribed.The main <strong>Haste</strong> file is composed of different sections (SeeFig. 12):• the definition of the types used across the design;• the definition of the system interface;• the external RTL functions import;• the <strong>Haste</strong> declaration of each block;• the block instance and connection.6. Case Study: a Commercial Audio CODECTo test our methodology we apply it <strong>to</strong> a <strong>Simulink</strong> modelof a commercial Audio CODEC. Such a model describes oneof the two channels in a stereo audio chip implementing aSigma-Delta modula<strong>to</strong>r [17].8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!