To run the HDL workflow as a command-line script, configure and run the HDL Workflow Advisor with your Simulink® design, then export a script. The script uses HDL Workflow CLI commands to perform the same tasks as the HDL Workflow Advisor, including FPGA bitstream or synthesis project generation.
You can export an HDL workflow script for these target workflows:
Generic ASIC/FPGA
FPGA Turnkey
IP Core Generation
To update an existing script, import it into the HDL Workflow Advisor, modify the tasks, and export the updated script. Alternatively, you can manually edit the script.
In the HDL Workflow Advisor, configure and run all the tasks.
Select File > Export to Script.
In the Export Workflow Configuration dialog box, enter a file name and save the script.
The script is a MATLAB® file that you can run from the command line.
To disable all workflow tasks, update
the workflow configuration object with the hdlcoder.WorkflowConfig.clearAllTasks
method.
To reenable all workflow tasks, update the workflow configuration
object with the hdlcoder.WorkflowConfig.setAllTasks
method.
To run a single workflow task without rerunning other workflow tasks:
Disable all tasks
in the workflow configuration object by running the hdlcoder.WorkflowConfig.clearAllTasks
method.
In the workflow configuration object, enable the task that you want to run.
For example, if you previously ran an HDL workflow script and
generated a bitstream, you can program your target hardware without
rerunning the other workflow tasks. To run the target device programming
task for an hdlcoder.WorkflowConfig
workflow configuration
object, hCfg
and Simulink design, model/DUTname
:
Run the clearAllTasks
method.
hCfg.clearAllTasks;
Enable the target device programming task.
hCfg.RunTaskProgramTargetDevice = true;
Run the workflow.
hdlcoder.runWorkflow('model/DUTname', hCfg);
In the HDL Workflow Advisor, select File > Import from Script.
In the Import Workflow Configuration dialog box, select the script file and click Open.
The HDL Workflow Advisor updates the tasks with the imported script settings.
This example shows how to configure and run an exported HDL workflow script.
This script is a generic ASIC/FPGA workflow script that targets a Xilinx® Virtex® 7 device. It uses the Xilinx Vivado® synthesis tool.
Open and view your exported HDL workflow script.
% Export Workflow Configuration Script % Generated with MATLAB 8.6 (R2015b) at 11:33:25 on 08/07/2015 % Parameter Values: % Filename : 'S:\generic_workflow_example.m' % Overwrite : true % Comments : true % Headers : true % DUT : 'sfir_fixed/symmetric_fir1' %% Load the Model load_system('sfir_fixed'); %% Model HDL Parameters % Set Model HDL parameters hdlset_param('sfir_fixed', 'HDLSubsystem', 'sfir_fixed/symmetric_fir1'); hdlset_param('sfir_fixed', 'SynthesisTool', 'Xilinx Vivado'); hdlset_param('sfir_fixed', 'SynthesisToolChipFamily', 'Virtex7'); hdlset_param('sfir_fixed', 'SynthesisToolDeviceName', 'xc7vx485t'); hdlset_param('sfir_fixed', 'SynthesisToolPackageName', 'ffg1761'); hdlset_param('sfir_fixed', 'SynthesisToolSpeedValue', '-2'); hdlset_param('sfir_fixed', 'TargetDirectory', 'hdl_prj\hdlsrc'); %% Workflow Configuration Settings % Construct the Workflow Configuration Object with default settings hWC = hdlcoder.WorkflowConfig('SynthesisTool','Xilinx Vivado','TargetWorkflow', ... 'Generic ASIC/FPGA'); % Specify the top level project directory hWC.ProjectFolder = 'hdl_prj'; % Set Workflow tasks to run hWC.RunTaskGenerateRTLCodeAndTestbench = true; hWC.RunTaskVerifyWithHDLCosimulation = true; hWC.RunTaskCreateProject = true; hWC.RunTaskRunSynthesis = true; hWC.RunTaskRunImplementation = false; hWC.RunTaskAnnotateModelWithSynthesisResult = true; % Set Properties related to Generate RTL Code And Testbench Task hWC.GenerateRTLCode = true; hWC.GenerateRTLTestbench = false; hWC.GenerateCosimulationModel = false; hWC.CosimulationModelForUseWith = 'Mentor Graphics ModelSim'; hWC.GenerateValidationModel = false; % Set Properties related to Create Project Task hWC.Objective = hdlcoder.Objective.None; hWC.AdditionalProjectCreationTclFiles = ''; % Set Properties related to Run Synthesis Task hWC.SkipPreRouteTimingAnalysis = false; % Set Properties related to Run Implementation Task hWC.IgnorePlaceAndRouteErrors = false; % Set Properties related to Annotate Model With Synthesis Result Task hWC.CriticalPathSource = 'pre-route'; hWC.CriticalPathNumber = 1; hWC.ShowAllPaths = false; hWC.ShowDelayData = true; hWC.ShowUniquePaths = false; hWC.ShowEndsOnly = false; % Validate the Workflow Configuration Object hWC.validate; %% Run the workflow hdlcoder.runWorkflow('sfir_fixed/symmetric_fir1', hWC);
Optionally, edit the script.
For example, enable or disable tasks in the hdlcoder.WorkflowConfig
object, hWC
.
Run the HDL workflow script.
For example, if the script file name is generic_workflow_example.m
,
at the command line, enter:
generic_workflow_example.m
This example shows how to configure and run an exported HDL workflow script.
This script is an FPGA Turnkey workflow script that targets a Xilinx Virtex 5 development board. It uses the Xilinx ISE synthesis tool.
Open and view your exported HDL workflow script.
% Export Workflow Configuration Script % Generated with MATLAB 8.6 (R2015b) at 14:24:32 on 08/07/2015 % Parameter Values: % Filename : 'S:\turnkey_workflow_example.m' % Overwrite : true % Comments : true % Headers : true % DUT : 'hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA' %% Load the Model load_system('hdlcoderUARTServoControllerExample'); %% Model HDL Parameters % Set Model HDL parameters hdlset_param('hdlcoderUARTServoControllerExample', ... 'HDLSubsystem', 'hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA'); hdlset_param('hdlcoderUARTServoControllerExample', ... 'SynthesisTool', 'Xilinx ISE'); hdlset_param('hdlcoderUARTServoControllerExample', ... 'SynthesisToolChipFamily', 'Virtex5'); hdlset_param('hdlcoderUARTServoControllerExample', ... 'SynthesisToolDeviceName', 'xc5vsx50t'); hdlset_param('hdlcoderUARTServoControllerExample', ... 'SynthesisToolPackageName', 'ff1136'); hdlset_param('hdlcoderUARTServoControllerExample', ... 'SynthesisToolSpeedValue', '-1'); hdlset_param('hdlcoderUARTServoControllerExample', ... 'TargetDirectory', 'hdl_prj\hdlsrc'); hdlset_param('hdlcoderUARTServoControllerExample', ... 'TargetPlatform', 'Xilinx Virtex-5 ML506 development board'); hdlset_param('hdlcoderUARTServoControllerExample', 'Workflow', 'FPGA Turnkey'); % Set Inport HDL parameters hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/uart_rxd', ... 'IOInterface', 'RS-232 Serial Port Rx'); hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/uart_rxd', ... 'IOInterfaceMapping', '[0]'); % Set Outport HDL parameters hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/uart_txd', ... 'IOInterface', 'RS-232 Serial Port Tx'); hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/uart_txd', ... 'IOInterfaceMapping', '[0]'); % Set Outport HDL parameters hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/version', ... 'IOInterface', 'LEDs General Purpose [0:7]'); hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/version', ... 'IOInterfaceMapping', '[0:3]'); % Set Outport HDL parameters hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/pwm_output', ... 'IOInterface', 'Expansion Headers J6 Pin 2-64 [0:31]'); hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/pwm_output', ... 'IOInterfaceMapping', '[0]'); % Set Outport HDL parameters hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/servo_debug1', ... 'IOInterface', 'Expansion Headers J6 Pin 2-64 [0:31]'); hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/servo_debug1', ... 'IOInterfaceMapping', '[1]'); % Set Outport HDL parameters hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/servo_debug2', ... 'IOInterface', 'Expansion Headers J6 Pin 2-64 [0:31]'); hdlset_param('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA/servo_debug2', ... 'IOInterfaceMapping', '[2]'); %% Workflow Configuration Settings % Construct the Workflow Configuration Object with default settings hWC = hdlcoder.WorkflowConfig('SynthesisTool','Xilinx ISE', ... 'TargetWorkflow','FPGA Turnkey'); % Specify the top level project directory hWC.ProjectFolder = 'hdl_prj'; % Set Workflow tasks to run hWC.RunTaskGenerateRTLCodeAndTestbench = true; hWC.RunTaskVerifyWithHDLCosimulation = true; hWC.RunTaskCreateProject = true; hWC.RunTaskPerformLogicSynthesis = true; hWC.RunTaskPerformMapping = true; hWC.RunTaskPerformPlaceAndRoute = true; hWC.RunTaskGenerateProgrammingFile = true; hWC.RunTaskProgramTargetDevice = false; % Set Properties related to Create Project Task hWC.Objective = hdlcoder.Objective.None; hWC.AdditionalProjectCreationTclFiles = ''; % Set Properties related to Perform Mapping Task hWC.SkipPreRouteTimingAnalysis = true; % Set Properties related to Perform Place and Route Task hWC.IgnorePlaceAndRouteErrors = false; % Validate the Workflow Configuration Object hWC.validate; %% Run the workflow hdlcoder.runWorkflow('hdlcoderUARTServoControllerExample/UART_Servo_on_FPGA', hWC);
Optionally, edit the script.
For example, enable or disable tasks in the hdlcoder.WorkflowConfig
object, hWC
.
Run the HDL workflow script.
For example, if the script file name is turnkey_workflow_example.m
,
at the command line, enter:
turnkey_workflow_example.m
This example shows how to configure and run an exported HDL workflow script.
This script is an IP core generation workflow script that targets the Altera® Cyclone V SoC development kit. It uses the Altera Quartus II synthesis tool.
Open and view your exported HDL workflow script.
% Export Workflow Configuration Script % Generated with MATLAB 8.6 (R2015b) at 14:42:16 on 08/07/2015 % Parameter Values: % Filename : 'S:\ip_core_gen_workflow_example.m' % Overwrite : true % Comments : true % Headers : true % DUT : 'hdlcoder_led_blinking/led_counter' %% Load the Model load_system('hdlcoder_led_blinking'); %% Model HDL Parameters % Set Model HDL parameters hdlset_param('hdlcoder_led_blinking', ... 'HDLSubsystem', 'hdlcoder_led_blinking/led_counter'); hdlset_param('hdlcoder_led_blinking', 'OptimizationReport', 'on'); hdlset_param('hdlcoder_led_blinking', ... 'ReferenceDesign', 'Default system (Qsys 14.0)'); hdlset_param('hdlcoder_led_blinking', 'ResetType', 'Synchronous'); hdlset_param('hdlcoder_led_blinking', 'ResourceReport', 'on'); hdlset_param('hdlcoder_led_blinking', 'SynthesisTool', 'Altera QUARTUS II'); hdlset_param('hdlcoder_led_blinking', 'SynthesisToolChipFamily', 'Cyclone V'); hdlset_param('hdlcoder_led_blinking', 'SynthesisToolDeviceName', '5CSXFC6D6F31C6'); hdlset_param('hdlcoder_led_blinking', 'TargetDirectory', 'hdl_prj\hdlsrc'); hdlset_param('hdlcoder_led_blinking', ... 'TargetPlatform', 'Altera Cyclone V SoC development kit - Rev.D'); hdlset_param('hdlcoder_led_blinking', 'Traceability', 'on'); hdlset_param('hdlcoder_led_blinking', 'Workflow', 'IP Core Generation'); % Set SubSystem HDL parameters hdlset_param('hdlcoder_led_blinking/led_counter', ... 'ProcessorFPGASynchronization', 'Free running'); % Set Inport HDL parameters hdlset_param('hdlcoder_led_blinking/led_counter/Blink_frequency', ... 'IOInterface', 'AXI4'); hdlset_param('hdlcoder_led_blinking/led_counter/Blink_frequency', ... 'IOInterfaceMapping', 'x"100"'); % Set Inport HDL parameters hdlset_param('hdlcoder_led_blinking/led_counter/Blink_direction', ... 'IOInterface', 'AXI4'); hdlset_param('hdlcoder_led_blinking/led_counter/Blink_direction', ... 'IOInterfaceMapping', 'x"104"'); % Set Outport HDL parameters hdlset_param('hdlcoder_led_blinking/led_counter/LED', 'IOInterface', 'External Port'); % Set Outport HDL parameters hdlset_param('hdlcoder_led_blinking/led_counter/Read_back', 'IOInterface', 'AXI4'); hdlset_param('hdlcoder_led_blinking/led_counter/Read_back', ... 'IOInterfaceMapping', 'x"108"'); %% Workflow Configuration Settings % Construct the Workflow Configuration Object with default settings hWC = hdlcoder.WorkflowConfig('SynthesisTool','Altera QUARTUS II', ... 'TargetWorkflow','IP Core Generation'); % Specify the top level project directory hWC.ProjectFolder = 'hdl_prj'; % Set Workflow tasks to run hWC.RunTaskGenerateRTLCodeAndIPCore = true; hWC.RunTaskCreateProject = true; hWC.RunTaskGenerateSoftwareInterfaceModel = false; hWC.RunTaskBuildFPGABitstream = true; hWC.RunTaskProgramTargetDevice = false; % Set Properties related to Generate RTL Code And IP Core Task hWC.IPCoreRepository = ''; hWC.GenerateIPCoreReport = true; % Set Properties related to Create Project Task hWC.Objective = hdlcoder.Objective.AreaOptimized; % Set Properties related to Generate Software Interface Model Task hWC.OperatingSystem = ''; hWC.AddLinuxDeviceDriver = false; % Set Properties related to Build FPGA Bitstream Task hWC.RunExternalBuild = true; hWC.TclFileForSynthesisBuild = hdlcoder.BuildOption.Default; % Validate the Workflow Configuration Object hWC.validate; %% Run the workflow hdlcoder.runWorkflow('hdlcoder_led_blinking/led_counter', hWC);
Optionally, edit the script.
For example, enable or disable tasks in the hdlcoder.WorkflowConfig
object, hWC
.
Run the HDL workflow script.
For example, if the script file name is ip_core_workflow_example.m
,
at the command line, enter:
ip_core_gen_workflow_example.m