{"id":9410,"date":"2025-04-18T09:11:14","date_gmt":"2025-04-18T09:11:14","guid":{"rendered":"https:\/\/liquidinstruments.com\/?p=9410"},"modified":"2025-06-11T22:34:54","modified_gmt":"2025-06-11T22:34:54","slug":"cloud-compile-with-mathworks-hdl-coder-pt-2","status":"publish","type":"post","link":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/","title":{"rendered":"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>This is Part 2 of the \u201cMoku Cloud Compile with MathWorks HDL Coder\u201d tutorial. Part 1 can be found <a href=\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder\/\" target=\"_blank\" rel=\"noopener\">here<\/a>. Now, we will use MathWorks\u2019 Simulink to build and deploy a two-channel Schmitt trigger on Moku:Pro. The general workflow between the MATLAB script approach and Simulink model approach is similar, but Simulink provides additional first-party DSP and test blocks that are ready to use. The block diagram-based design method provides a more intuitive way to construct a DSP workflow, especially for more complicated systems. In this tutorial, we will construct the first channel via a hybrid MATLAB-Simulink design and the second channel with the Simulink library.<\/p>\n<hr \/>\n<h2>Overview<\/h2>\n<p>Liquid Instruments\u2019 Moku Cloud Compile (MCC) tool enables users to design custom instruments for implementation on Moku platforms. Compared to CPU and application-specific integrated circuit (ASIC) based DSP approaches, FPGAs provide ASIC-level input-to-output latency while being software-defined and reprogrammable like a CPU. FPGA programming is typically done with hardware description language (HDL). The learning curve for HDL coding can be steep compared to software programming languages, but there are a few tools available to convert scripts in other programming languages to HDL. We covered how to use MathWorks HDL coder to convert a MATLAB script into HDL code for implementation on a Moku:Pro in Part I of the tutorial, in this Part II we will demonstrate how to generate HDL code from a Simulink model.<\/p>\n<p>Simulink is a graphical-based modeling tool developed by MathWorks. The block diagram-based design philosophy streamlines the process of translating a hand-drawn digital signal processing (DSP) system into a computer-based model. The virtual test and measurement instruments, such as waveform generators and oscilloscopes, provide a more intuitive way to construct the testbench and validate the DSP model. In addition, users have the option to use Simulink to build a fixed-point system from the ground up. Some of the logic operations are easier to implement with MATLAB functions, in this case users can add MATLAB function blocks into their design. For more complicated systems, utilizing both tools could significantly streamline the design process.<\/p>\n<p>In this tutorial, we will construct a two-channel Schmitt trigger. The basics and concept design of the Schmitt Trigger can be found Part I of the tutorial. For the first channel, we will use the exact same MATLAB function from Part I of the tutorial to construct the DSP. For the second channel, we will use a Simulink built-in DSP block to achieve the same function.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23745 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2-1024x564.png\" alt=\"Figure 1: Recommended workflow for Moku Cloud Compile + HDL Coder DSP Design.\" width=\"632\" height=\"348\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2-1024x564.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2-300x165.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2-768x423.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2-600x331.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png 1279w\" sizes=\"(max-width: 632px) 100vw, 632px\" \/><br \/>\n<em>Figure 1: Recommended workflow for Moku Cloud Compile + HDL Coder DSP Design.<\/em><\/p>\n<h4>Requirements<\/h4>\n<p>Before we get started with building and implementing the Schmitt trigger, please ensure your system satisfies the following requirements. For generating VHDL code from a Simulink model you will need to have MATLAB with Simulink, HDL Coder, and Fixed-Point Converter. Note: Mac users will also need to have XCode installed for MATLAB to generate the VHDL code. For compiling the VHDL code you will need to have access to Moku Cloud Compile. For implementing the compiled instrument bitstream, you will need to have a Moku:Pro running firmware version 601 or above, the Moku: app, and access to <a href=\"https:\/\/liquidinstruments.com\/multi-instrument-mode\/\" target=\"_blank\" rel=\"noopener\">Multi-Instrument Mode<\/a> on your Moku:Pro.<\/p>\n<h2>Design and construct the DSP<\/h2>\n<h4>Adjust the template<\/h4>\n<p>The first step in creating our model is to adjust the Simulink template to fit our DSP design. As our design is a two-channel system, we will only need the InputA, InputB, OutputA, and OutputB ports.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23746 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure2-1-1024x492.png\" alt=\"Figure 2: Remove the redundant channels\" width=\"586\" height=\"281\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure2-1-1024x492.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure2-1-300x144.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure2-1-768x369.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure2-1-1536x739.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure2-1-600x289.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure2-1.png 1618w\" sizes=\"(max-width: 586px) 100vw, 586px\" \/><br \/>\n<em>Figure 2: Remove the redundant channels.<\/em><\/p>\n<h4>Floating-point DSP design<\/h4>\n<p>In this section we will construct the two Schmitt triggers, with the first channel using a MATLAB function block and the second channel using a Simulink trigger block.<\/p>\n<p>Simulink building blocks can be found in the \u201cLibrary Browser\u201d under the simulation tab. The search function is the best way to find the desired element. Please note that not all Simulink blocks support HDL code generation. We recommend only using blocks under the \u201cHDL Coder\u201d or \u201cHDL Support\u201d catalog for everything within the DSP subsystem.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23747 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure3-1-1024x644.png\" alt=\"Figure 3: Simulink building blocks can be found via the Library Browser.\" width=\"561\" height=\"353\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure3-1-1024x644.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure3-1-300x189.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure3-1-768x483.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure3-1-1536x966.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure3-1-600x377.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure3-1.png 1739w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><br \/>\n<em>Figure 3: Simulink building blocks can be found via the Library Browser.<\/em><\/p>\n<p>For the first channel we will place a MATLAB function block in the model. As the MATLAB function is a floating-point model and the Simulink template has pre-defined the data type for all the ports, the data type will not match. We address this issue by placing two \u201cconvert\u201d blocks before and after the MATLAB function block. Users can design the model with a fixed-point algorithm, but we find it is easier to start with floating-point when implementing a MATLAB function block in the model. Please note the first convert block may need to be removed before the HDL conversion step.<\/p>\n<p>To add the Schmitt trigger function to the MATLAB function block, double-click the block. We will use the same MATLAB function as Part I of the tutorial, except for the function name (so we are not using the same name for the MATLAB function and Simulink subsystem).<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23748 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure4-1-1024x195.png\" alt=\"Figure 4: Block diagram design of the MATLAB function-based Schmitt trigger.\" width=\"727\" height=\"138\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure4-1-1024x195.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure4-1-300x57.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure4-1-768x146.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure4-1-600x114.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure4-1.png 1249w\" sizes=\"(max-width: 727px) 100vw, 727px\" \/><br \/>\n<em>Figure 4: Block diagram design of the MATLAB function-based Schmitt trigger.<\/em><\/p>\n<p>&nbsp;<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">function <span style=\"color: #000000;\">OutputA = Schmitt_Trigger(InputA)<\/span>\r\n<span style=\"color: #339966;\">%#codegen<\/span>\r\npersistent <span style=\"color: #000000;\">out0;<\/span> <span style=\"color: #339966;\">%Retains variable value between function calls.<\/span>\r\nif <span style=\"color: #000000;\">isempty(out0)<\/span> <span style=\"color: #339966;\">%Initialize the value for the first call.<\/span>\r\n     <span style=\"color: #000000;\">out0 = 0;<\/span>\r\nend\r\n\r\n<span style=\"color: #000000;\">upperThreshold = floor(2^15\/10);<\/span> <span style=\"color: #339966;\">%Set the upper threshold to 1\/10 of the full positive range.<\/span>\r\n<span style=\"color: #000000;\">lowerThreshold = -floor(2^15\/10);<\/span> <span style=\"color: #339966;\">%Set the lower threshold to 1\/10 of the full negative range.<\/span>\r\n\r\nif <span style=\"color: #000000;\">InputA &gt;upperThrehold<\/span> <span style=\"color: #339966;\">%Logic to perform the Schmitt trigger function.<\/span>\r\n     <span style=\"color: #000000;\">out0 = 2^15-1;<\/span> <span style=\"color: #339966;\">%Map to the highest positive number.<\/span>\r\nelseif <span style=\"color: #000000;\">InputA &lt;lowerThreshold<\/span>\r\n     <span style=\"color: #000000;\">out0 = 0;<\/span>\r\nend\r\n\r\n<span style=\"color: #000000;\">OutputA = out0;<\/span> <span style=\"color: #339966;\">%Assign variable out0 to OutputA.<\/span><\/span><\/pre>\n<\/blockquote>\n<p>&nbsp;<\/p>\n<p>For the second channel, we will use Simulink\u2019s \u201cRelay\u201d block to perform the Schmitt trigger logic. We placed the relay block between InputB and OutputB, then double-clicked the \u201cRelay\u201d block to change the switch on and off thresholds to floor(2^15\/10), and &#8211; floor(2^15\/10), respectively. In the \u201cSignal Attributes\u201d tab, set the signal output to <em>fixdt(1, 16,0)<\/em> to match the output.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23749 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure5-1-1024x569.png\" alt=\"Figure 5: The \u201cRelay\u201d block was set to perform the same Schmitt trigger logic as the first channel.\" width=\"642\" height=\"357\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure5-1-1024x569.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure5-1-300x167.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure5-1-768x427.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure5-1-1536x854.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure5-1-600x333.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure5-1.png 1733w\" sizes=\"(max-width: 642px) 100vw, 642px\" \/><br \/>\n<em>Figure 5: The &#8220;Relay&#8221; block was set to perform the same Schmitt trigger logic as the first channel.<\/em><\/p>\n<h4>Construct the testbench<\/h4>\n<p>Simulink has a built-in signal generator, oscilloscope, and other common test and measurement equipment blocks. This allows us to design the testbench in a more intuitive way. Please note the building blocks outside of the DSP system do not need to be supported by HDL Coder, as they will be used for simulation only.<\/p>\n<p>To construct the testbench, we used a \u201cSignal Generator\u201d block to produce the same signal we used for the testbench in Part I. We rescaled and converted the signal from the generator to match the 16-bit signed input for our system. Before feeding the signal into the Inputs, an additional \u201cConvert\u201d block was added to convert the floating-point numbers to fixed-point. Then, we fed the generator signal, OuputA, and OutputB into the oscilloscope to observe the system response.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23750 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure6-1-1024x487.png\" alt=\"Figure 6: Block diagram of the Simulink-based testbench\" width=\"633\" height=\"301\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure6-1-1024x487.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure6-1-300x143.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure6-1-768x366.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure6-1-1536x731.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure6-1-600x286.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure6-1.png 1708w\" sizes=\"(max-width: 633px) 100vw, 633px\" \/><br \/>\n<em>Figure 6: Block diagram of the Simulink-based testbench.<\/em><\/p>\n<p>Once the system is constructed, we run the simulation and verify the output. We observed the output signal was as expected.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23751 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure7-1-1024x778.png\" alt=\"Figure 7: The output of the DSP subsystem on the oscilloscope.\" width=\"620\" height=\"471\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure7-1-1024x778.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure7-1-300x228.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure7-1-768x584.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure7-1-600x456.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure7-1.png 1450w\" sizes=\"(max-width: 620px) 100vw, 620px\" \/><br \/>\n<em>Figure 7: The output of the DSP subsystem on the Oscilloscope.<\/em><\/p>\n<h4>Fixed-point conversion<\/h4>\n<p>Before generating the VHDL code for our DSP subsystem, we will need to convert the floating-point MATLAB function block to a fixed-point function block. We achieve this using MathWorks\u2019 Fixed-Point Tool in the \u201cApps\u201d tab, with \u201cIterative Fixed-Point Conversion\u201d method. Please note that if we build the Simulink model with fixed-point DSP from the beginning, we do not have to run the fixed-point conversion.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23752 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure8-1-1024x648.png\" alt=\"Figure 8: Iterative Fixed-Point Conversion can be initiated via the Simulink Apps tab.\" width=\"534\" height=\"338\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure8-1-1024x648.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure8-1-300x190.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure8-1-768x486.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure8-1-1536x972.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure8-1-600x380.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure8-1.png 1605w\" sizes=\"(max-width: 534px) 100vw, 534px\" \/><br \/>\n<em>Figure 8: Iterative Fixed-Point Conversion can be initiated via the Simulink Apps tab.<\/em><\/p>\n<p>Next, we selected the MATLAB function as the target and initiated the conversion process by clicking the \u201cCollect Ranges\u201d button. Simulink uses the testbech data points as the reference to convert the model.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23753 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure9-1024x600.png\" alt=\"Figure 9: The MATLAB function was selected as the \u201cSystem Under Design.&quot;\" width=\"567\" height=\"332\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure9-1024x600.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure9-300x176.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure9-768x450.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure9-1536x901.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure9-600x352.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure9.png 1733w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><br \/>\n<em>Figure 9: The MATLAB function was selected as the &#8220;System Under Design.&#8221;<\/em><\/p>\n<p>Then, we can use the \u201cPropose Data Types\u201d button to let Simulink decide the best fixed-point precision. The histograms in the bottom displays the range of each signal. We can manually override any signal precision if needed. Once the precisions are decided, we can use the \u201cApply Data Types\u201d button to proceed the conversion.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23754 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure10-1-1024x878.png\" alt=\"Figure 10: (1) Propose the signal precision based on the testbench data; (2) Observe the signal range with the histograms; (3) Proceed to convert the model to fixed-point design. (4) Delete the first \u201cconvert\u201d block.\" width=\"571\" height=\"490\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure10-1-1024x878.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure10-1-300x257.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure10-1-768x658.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure10-1-600x514.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure10-1.png 1169w\" sizes=\"(max-width: 571px) 100vw, 571px\" \/><br \/>\n<em>Figure 10: (1) Propose the signal precision based on the testbench data; (2) Observe the signal range with the histograms; (3) Proceed to convert the model to fixed-point design. (4) Delete the first &#8220;convert&#8221; block.<\/em><\/p>\n<p>After the fixed-point conversion, the first &#8220;Convert&#8221; block needs to be removed; as the new &#8220;MATLAB Function&#8221; block takes in fixed-point numbers instead of floating\/double.<\/p>\n<h4>Fixed-point model verification<\/h4>\n<p>After the models have been converted, it is important to run another round of simulation to make sure the behaviors and precision loss are as expected.<\/p>\n<h4>VHDL code generation<\/h4>\n<p>HDL code can be generated by clicking the &#8220;Generate HDL Code&#8221; button under the HDL Code tab. HDL Coder generation settings are already preconfigured in the Simulink template, therefore we do not need to adjust settings here.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23755 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure11-1024x127.png\" alt=\"Figure 11: \u201cGenerate HDL Code\u201d button is located under the HDL Code app.\" width=\"717\" height=\"89\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure11-1024x127.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure11-300x37.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure11-768x95.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure11-1536x191.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure11-600x74.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure11.png 1781w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><br \/>\n<em>Figure 11: &#8220;Generate HDL Code&#8221; button is located under the HDL Code app.<\/em><\/p>\n<h4>VHDL simulation with a third-party tool (Optional)<\/h4>\n<p>VHDL testbench file can be generated by clicking the &#8220;Generate Testbench&#8221; button under the HDL Code app. The verification step is identical to the MATLAB example.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23756 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure12-1024x131.png\" alt=\" Figure 12: \u201cGenerate Testbench\u201d button is located under the HDL Code app.\" width=\"727\" height=\"93\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure12-1024x131.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure12-300x39.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure12-768x99.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure12-1536x197.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure12-600x77.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure12.png 1761w\" sizes=\"(max-width: 727px) 100vw, 727px\" \/><br \/>\n<em>Figure 12: &#8220;Generate Testbench&#8221; button is located under the HDL Code app.<\/em><\/p>\n<h2>DSP Compile and Deployment<\/h2>\n<p>Moku Cloud Compile has a standard wrapper built-in to allow the custom instrument to interact with the other parts of the Moku:Pro. The standard wrapper uses all four input channels and output channels for the instrument; this does not match our Schmitt trigger example, which has two inputs and two outputs. Therefore, we will need to create a custom wrapper for the instrument from the provided template.<\/p>\n<p>Please note even with the \u201cMinimize clock enables\u201d option selected, sometimes HDL Coder still generates VHDL code with <em>clock_enable<\/em> and <em>ce_out<\/em> ports (like in this tutorial). We will connect the <em>clock_enable<\/em> with a constant high signal and leave the ce_out ports open if these ports are created during the VHDL conversion process.<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">ARCHITECTURE <span style=\"color: #000000;\">HDLCoderWrapper<\/span> OF <span style=\"color: #000000;\">CustomWrapper<\/span> IS\r\n<span style=\"color: #339966;\">-- SIGNAL Declarations<\/span>\r\nSIGNAL <span style=\"color: #000000;\">ConstantHigh:std_logic.        :='1';<\/span>\r\n<span style=\"color: #339966;\">--Component Declarations<\/span>\r\nCOMPONENT <span style=\"color: #000000;\">DSP<\/span>\r\n<span style=\"color: #000000;\">PORT(Clk                              :<\/span> <span style=\"color: #ff00ff;\">IN<\/span> <span style=\"color: #000000;\">std_logic;<\/span>\r\n     <span style=\"color: #000000;\">Reset                            :<\/span> <span style=\"color: #ff00ff;\">IN<\/span> <span style=\"color: #000000;\">std_logic;<\/span>\r\n     <span style=\"color: #000000;\">clk_enable                       :<\/span> <span style=\"color: #ff00ff;\">IN<\/span> <span style=\"color: #000000;\">std_logic;<\/span>\r\n     <span style=\"color: #000000;\">InputA                           :<\/span> <span style=\"color: #ff00ff;\">IN<\/span> <span style=\"color: #000000;\">signed(15 DOWNTO 0); -- sfix16_En16<\/span>\r\n     <span style=\"color: #000000;\">InputB<\/span>                          <span style=\"color: #000000;\"> :<\/span> <span style=\"color: #ff00ff;\">IN<\/span> <span style=\"color: #000000;\">signed(15 DOWNTO 0); -- sfix16_En16<\/span>\r\n     <span style=\"color: #000000;\">ce_out_0                         :<\/span> <span style=\"color: #ff00ff;\">OUT<\/span> <span style=\"color: #000000;\">std_logic;<\/span>\r\n     <span style=\"color: #000000;\">ce_out_1                         :<\/span> <span style=\"color: #ff00ff;\">OUT<\/span> <span style=\"color: #000000;\">std_logic;<\/span>\r\n     <span style=\"color: #000000;\">OutputA                          :<\/span> <span style=\"color: #ff00ff;\">OUT<\/span> <span style=\"color: #000000;\">signed(15 DOWNTO 0); -- sfix16_En14<\/span>\r\n     <span style=\"color: #000000;\">OutputB                          :<\/span> <span style=\"color: #ff00ff;\">OUT<\/span> <span style=\"color: #000000;\">signed(15 DOWNTO 0); -- sfix16_En14<\/span>\r\n     <span style=\"color: #000000;\">);<\/span>\r\nEND COMPONENT<span style=\"color: #000000;\">;<\/span>\r\n\r\nBEGIN\r\n     <span style=\"color: #000000;\">u_DSP:DSP<\/span>\r\n          PORT MAP<span style=\"color: #000000;\">(Clk =&gt; Clk,<\/span>\r\n               <span style=\"color: #000000;\">Reset =&gt; Reset,<\/span>\r\n<span style=\"color: #000000;\">               clk_enable =&gt; ConstantHigh,<\/span>\r\n<span style=\"color: #000000;\">               InputA =&gt; InputA,<\/span>\r\n<span style=\"color: #000000;\">               InputB =&gt; InputB,<\/span>\r\n<span style=\"color: #000000;\">               ce_out_0 =&gt; <span style=\"color: #ff00ff;\">open<\/span>,<\/span>\r\n<span style=\"color: #000000;\">               ce_out_1 =&gt; <span style=\"color: #ff00ff;\">open<\/span>,<\/span>\r\n<span style=\"color: #000000;\">               OutputA =&gt; OutputA,<\/span>\r\n<span style=\"color: #000000;\">               OutputB =&gt; OutputB<\/span>\r\n<span style=\"color: #000000;\">          );<\/span>\r\n<span style=\"color: #ff00ff;\">END<\/span> <span style=\"color: #000000;\">HDLCoderWrapper;<\/span><\/span><\/pre>\n<\/blockquote>\n<h4>Compiling and deploying the instrument<\/h4>\n<p>Detailed instructions on how to use Moku Cloud Compile to build instrument bitstream and deploy the instrument can be found in our <a href=\"https:\/\/download.liquidinstruments.com\/documentation\/guide\/software\/moku-cloud-compile\/Moku-Cloud-Compile-Getting-Started.pdf\">Moku Cloud Compile Getting Started Guide<\/a>.<\/p>\n<p>To compile the Schmitt trigger, create a new project on Liquid Instruments&#8217; Moku Cloud Compile. In this project, create a file for the DSP_fixpt.vhd, which is the VHDL code for the Schmitt trigger; also create a wrapper file for the custom wrapper from the previous sections. Select a target device as a Moku:Pro with 4 slots and build the project. Once the bitstream is built, you will be able to deploy the Schmitt trigger on your Moku:Pro using the web interface and the Moku: app.<\/p>\n<p>To demonstrate the Schmitt trigger is functioning as per our conceptual design, we implemented the instrument on a Moku:Pro using the Moku: App and Multi-Instrument Mode. In slot 1, we placed in an Arbitrary Waveform Generator to generate the same signal we have used in the testbench as the input signal to the Schmitt trigger. In slot 2, we placed in our Schmitt trigger. In Slot 3, we placed in an Oscilloscope to compare the output signals from the Schmitt trigger and the Arbitrary Waveform Generator.<\/p>\n<p>We first verify the Schmitt trigger in Channel A designed with the MATLAB function block. We can confirm the output from the Schmitt trigger is switched to high when the input signal is above 110 mV and waited until the signal is dropped below -110 mV to switch to zero.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23757 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure13-1024x273.png\" alt=\"Figure 13: (a) Multi-Instrument system configureation for testing the MATLAB function bloc Schmitt trigger. (b) Oscilloscope measurement verifying the Schmitt trigger is functioning as designed.\" width=\"678\" height=\"181\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure13-1024x273.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure13-300x80.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure13-768x205.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure13-1536x409.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure13-600x160.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure13.png 1797w\" sizes=\"(max-width: 678px) 100vw, 678px\" \/><br \/>\n<em>Figure 13: (a) Multi-instrument system configuration for testing the MATLAB function bloc Schmitt trigger. (b) Oscilloscope measurement verifying the Schmitt trigger is functioning as designed.<\/em><\/p>\n<p>We also verified the Schmitt trigger in Channel B, which was designed using the Simulink trigger block, and observed the same behavior.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23758 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure14-1024x273.png\" alt=\"Figure 14: (a) Multi-Instrument system configuration for testing the Simulink trigger block Schmitt trigger. (b) Oscilloscope measurement verifying the Schmitt trigger is functioning as designed.\" width=\"678\" height=\"181\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure14-1024x273.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure14-300x80.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure14-768x205.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure14-1536x409.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure14-600x160.png 600w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure14.png 1798w\" sizes=\"(max-width: 678px) 100vw, 678px\" \/><br \/>\n<em>Figure 14: (a) Multi-instrument system configuration for testing the Simulink trigger block Schmitt trigger. (b) Oscilloscope measurement verifying the Schmitt trigger is functioning as designed.<\/em><\/p>\n<p>Finally we compared the two output channels together and can verify that they switch to high and low at the same point.<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"alignnone wp-image-23759 \" src=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure15-1024x566.png\" alt=\"Figure 15: The Schmitt trigger designed using the MATLAB function block and the trigger block have the same behaviors.\" width=\"689\" height=\"381\" srcset=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure15-1024x566.png 1024w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure15-300x166.png 300w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure15-768x425.png 768w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure15-1536x849.png 1536w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure15-2048x1132.png 2048w, https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure15-600x332.png 600w\" sizes=\"(max-width: 689px) 100vw, 689px\" \/><br \/>\n<em>Figure 15: The Schmitt trigger designed using the MATLAB function block and the trigger block have the same behaviors.<\/em><\/p>\n<h2>Conclusion<\/h2>\n<p>In this second part of the tutorial, we covered how to utilize MathWorks\u2019 Simulink and HDL Coder to build, validate, and deploy a DSP model on Moku:Pro. Compared to MATLAB only approach, Simulink gives you the option to design the DSP via its DSP library and build the model with the fixed-point model from the ground up. It is recommended for building complicated DSP systems.<\/p>\n<h2>Code availability<\/h2>\n<p>The source code for this project can be downloaded <a href=\"https:\/\/github.com\/liquidinstruments\/moku-examples\/tree\/main\/mc\/HDLCoder\/hdlcoder_schmitt_trigger\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<hr style=\"margin: 50px 0 50px 0 !important;\" \/>\n<h2><\/h2>\n<h2>Have questions or want a printable version?<\/h2>\n<p>Please contact us at <a href=\"mailto:support@liquidinstruments.com\">support@liquidinstruments.com<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>This is Part 2 of the \u201cMoku Cloud Compile with MathWorks HDL Coder\u201d tutorial. Part 1 can be found here. Now, we will use MathWorks\u2019 Simulink to build and deploy a two-channel Schmitt trigger on Moku:Pro. The general workflow between the MATLAB script approach and Simulink model approach is similar, but Simulink provides additional first-party [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":14,"featured_media":23745,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[5],"tags":[],"class_list":["post-9410","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-notes","site-category-matlab","site-category-moku-cloud-compile","site-category-mokupro"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink - Liquid Instruments<\/title>\n<meta name=\"description\" content=\"This is Part 2 of the \u201cMoku Cloud Compile with MathWorks HDL Coder\u201d tutorial. Part 1 can be found here. Now, we will use MathWorks\u2019 Simulink to build and\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink\" \/>\n<meta property=\"og:description\" content=\"This is Part 2 of the \u201cMoku Cloud Compile with MathWorks HDL Coder\u201d tutorial. Part 1 can be found here. Now, we will use MathWorks\u2019 Simulink to build and\" \/>\n<meta property=\"og:url\" content=\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Liquid Instruments\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/LiquidInstruments\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T09:11:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-11T22:34:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1279\" \/>\n\t<meta property=\"og:image:height\" content=\"705\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"joel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@liquidinstrmnts\" \/>\n<meta name=\"twitter:site\" content=\"@liquidinstrmnts\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"joel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/\"},\"author\":{\"name\":\"joel\",\"@id\":\"https:\/\/liquidinstruments.com\/#\/schema\/person\/603af464a65f123df56503f020b73dba\"},\"headline\":\"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink\",\"datePublished\":\"2025-04-18T09:11:14+00:00\",\"dateModified\":\"2025-06-11T22:34:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/\"},\"wordCount\":2034,\"publisher\":{\"@id\":\"https:\/\/liquidinstruments.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png\",\"articleSection\":[\"Application notes\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/\",\"url\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/\",\"name\":\"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink - Liquid Instruments\",\"isPartOf\":{\"@id\":\"https:\/\/liquidinstruments.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png\",\"datePublished\":\"2025-04-18T09:11:14+00:00\",\"dateModified\":\"2025-06-11T22:34:54+00:00\",\"description\":\"This is Part 2 of the \u201cMoku Cloud Compile with MathWorks HDL Coder\u201d tutorial. Part 1 can be found here. Now, we will use MathWorks\u2019 Simulink to build and\",\"breadcrumb\":{\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#primaryimage\",\"url\":\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png\",\"contentUrl\":\"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png\",\"width\":1279,\"height\":705,\"caption\":\"Figure 1: Recommended workflow for Moku Cloud Compile + HDL Coder DSP Design.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/liquidinstruments.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/liquidinstruments.com\/#website\",\"url\":\"https:\/\/liquidinstruments.com\/\",\"name\":\"Liquid Instruments\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/liquidinstruments.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/liquidinstruments.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/liquidinstruments.com\/#organization\",\"name\":\"Liquid Instruments\",\"url\":\"https:\/\/liquidinstruments.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/liquidinstruments.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/i0.wp.com\/liquidinstruments.com\/wp-content\/uploads\/2020\/10\/BrandMark-Preferred-RGB-Color.png?fit=1000%2C924&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/liquidinstruments.com\/wp-content\/uploads\/2020\/10\/BrandMark-Preferred-RGB-Color.png?fit=1000%2C924&ssl=1\",\"width\":1000,\"height\":924,\"caption\":\"Liquid Instruments\"},\"image\":{\"@id\":\"https:\/\/liquidinstruments.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/LiquidInstruments\/\",\"https:\/\/x.com\/liquidinstrmnts\",\"https:\/\/www.instagram.com\/liquidinstruments\/\",\"https:\/\/www.linkedin.com\/company\/liquidinstruments\/\",\"https:\/\/www.youtube.com\/c\/LiquidInstruments\",\"https:\/\/vimeo.com\/liquidinstruments\"],\"hasMerchantReturnPolicy\":{\"@type\":\"MerchantReturnPolicy\",\"merchantReturnLink\":\"https:\/\/liquidinstruments.com\/support\/warranty-repairs-and-service\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/liquidinstruments.com\/#\/schema\/person\/603af464a65f123df56503f020b73dba\",\"name\":\"joel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/liquidinstruments.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/61d26ea66bf9fb0a2379e1e6e8febb312981e656713bff920c55016dfe82495d?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/61d26ea66bf9fb0a2379e1e6e8febb312981e656713bff920c55016dfe82495d?s=96&d=wavatar&r=g\",\"caption\":\"joel\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink - Liquid Instruments","description":"This is Part 2 of the \u201cMoku Cloud Compile with MathWorks HDL Coder\u201d tutorial. Part 1 can be found here. Now, we will use MathWorks\u2019 Simulink to build and","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/","og_locale":"en_US","og_type":"article","og_title":"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink","og_description":"This is Part 2 of the \u201cMoku Cloud Compile with MathWorks HDL Coder\u201d tutorial. Part 1 can be found here. Now, we will use MathWorks\u2019 Simulink to build and","og_url":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/","og_site_name":"Liquid Instruments","article_publisher":"https:\/\/www.facebook.com\/LiquidInstruments\/","article_published_time":"2025-04-18T09:11:14+00:00","article_modified_time":"2025-06-11T22:34:54+00:00","og_image":[{"width":1279,"height":705,"url":"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png","type":"image\/png"}],"author":"joel","twitter_card":"summary_large_image","twitter_creator":"@liquidinstrmnts","twitter_site":"@liquidinstrmnts","twitter_misc":{"Written by":"joel","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#article","isPartOf":{"@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/"},"author":{"name":"joel","@id":"https:\/\/liquidinstruments.com\/#\/schema\/person\/603af464a65f123df56503f020b73dba"},"headline":"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink","datePublished":"2025-04-18T09:11:14+00:00","dateModified":"2025-06-11T22:34:54+00:00","mainEntityOfPage":{"@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/"},"wordCount":2034,"publisher":{"@id":"https:\/\/liquidinstruments.com\/#organization"},"image":{"@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#primaryimage"},"thumbnailUrl":"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png","articleSection":["Application notes"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/","url":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/","name":"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink - Liquid Instruments","isPartOf":{"@id":"https:\/\/liquidinstruments.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#primaryimage"},"image":{"@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#primaryimage"},"thumbnailUrl":"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png","datePublished":"2025-04-18T09:11:14+00:00","dateModified":"2025-06-11T22:34:54+00:00","description":"This is Part 2 of the \u201cMoku Cloud Compile with MathWorks HDL Coder\u201d tutorial. Part 1 can be found here. Now, we will use MathWorks\u2019 Simulink to build and","breadcrumb":{"@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#primaryimage","url":"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png","contentUrl":"https:\/\/liquidinstruments.com\/wp-content\/uploads\/2021\/10\/Figure1-2.png","width":1279,"height":705,"caption":"Figure 1: Recommended workflow for Moku Cloud Compile + HDL Coder DSP Design."},{"@type":"BreadcrumbList","@id":"https:\/\/liquidinstruments.com\/application-notes\/cloud-compile-with-mathworks-hdl-coder-pt-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/liquidinstruments.com\/"},{"@type":"ListItem","position":2,"name":"Moku Cloud Compile with MathWorks HDL Coder \u2013 Part 2: Simulink"}]},{"@type":"WebSite","@id":"https:\/\/liquidinstruments.com\/#website","url":"https:\/\/liquidinstruments.com\/","name":"Liquid Instruments","description":"","publisher":{"@id":"https:\/\/liquidinstruments.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/liquidinstruments.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/liquidinstruments.com\/#organization","name":"Liquid Instruments","url":"https:\/\/liquidinstruments.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/liquidinstruments.com\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/liquidinstruments.com\/wp-content\/uploads\/2020\/10\/BrandMark-Preferred-RGB-Color.png?fit=1000%2C924&ssl=1","contentUrl":"https:\/\/i0.wp.com\/liquidinstruments.com\/wp-content\/uploads\/2020\/10\/BrandMark-Preferred-RGB-Color.png?fit=1000%2C924&ssl=1","width":1000,"height":924,"caption":"Liquid Instruments"},"image":{"@id":"https:\/\/liquidinstruments.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/LiquidInstruments\/","https:\/\/x.com\/liquidinstrmnts","https:\/\/www.instagram.com\/liquidinstruments\/","https:\/\/www.linkedin.com\/company\/liquidinstruments\/","https:\/\/www.youtube.com\/c\/LiquidInstruments","https:\/\/vimeo.com\/liquidinstruments"],"hasMerchantReturnPolicy":{"@type":"MerchantReturnPolicy","merchantReturnLink":"https:\/\/liquidinstruments.com\/support\/warranty-repairs-and-service\/"}},{"@type":"Person","@id":"https:\/\/liquidinstruments.com\/#\/schema\/person\/603af464a65f123df56503f020b73dba","name":"joel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/liquidinstruments.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/61d26ea66bf9fb0a2379e1e6e8febb312981e656713bff920c55016dfe82495d?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/61d26ea66bf9fb0a2379e1e6e8febb312981e656713bff920c55016dfe82495d?s=96&d=wavatar&r=g","caption":"joel"}}]}},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/posts\/9410","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/comments?post=9410"}],"version-history":[{"count":16,"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/posts\/9410\/revisions"}],"predecessor-version":[{"id":24329,"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/posts\/9410\/revisions\/24329"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/media\/23745"}],"wp:attachment":[{"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/media?parent=9410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/categories?post=9410"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/liquidinstruments.com\/wp-json\/wp\/v2\/tags?post=9410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}