Main Content

Define Properties of Hardware Boards

The soc.sdk.Hardware object contains all of the specifications for a specific hardware board in the soc.sdk.BoardSupport framework. The specifications and objects added to the soc.sdk.Hardware object enable the blocks and features in SoC Blockset™ when the hardware board is selected.

The following code creates a new soc.sdk.Hardware object with an internal name of MySoCHardware.

hardwareObj = soc.sdk.Hardware(...
    "MySoCHardware"...     % Internal Board Name

The resulting empty Hardware object appears as follows.

hardwareObj = 

  Hardware with properties:

            ProcessorCores: {}
                 FPGACores: {}
                    Memory: {}
                      LEDs: {}
                    Clocks: {}
               DIPSwitches: {}
                    Resets: {}
               PushButtons: {}
     DeviceTreeSourceFiles: {}
    DeviceTreeIncludeFiles: {}
                      Name: 'MySoCHardware'
                  DeviceID: 'ARM Compatible->ARM Cortex'
               IOInterface: {}

After creating an object, you can add properties related to the processor, memory, FPGA, and device I/O to the soc.sdk.Hardware object.

Add Processor Information

A processor in an soc.sdk.Hardware object is defined by the DeviceID property, which specifies the type of processor, such as the ARM® Cortex®-A53. Individual cores within the processor can then be defined using the addNewProcessorCore method.

The following code shows how to add a processor and make a processor core available.

procCoreObj = addNewProcessorCore(...    
    hardwareObj,...        % Hardware object          
    "Core0"...             % Core name
procCoreObj.DeviceID = "ARM Compatible->ARM 64-bit (LP64)";
procCoreObj.Vendor = "Xilinx";
procCoreObj.Family = "Unknown";

For models that use this hardware board, the number of processor cores are available in the Task Manager block.

Add FPGA Programmable Logic Information

The FPGA programmable logic in an soc.sdk.Hardware object is defined by an soc.sdk.FPGACore object that contains the manufacturer identification, IP instantiation and constraints. The FPGACore object contains either soc.sdk.ProcessingSystem or soc.sdk.MemorySystem. soc.sdk.ProcessingSystem defines the interface and instantiation of processing system IP, and soc.sdk.MemorySystem defines the interface and instantiation of memory controller IP.

The following code shows how to add the FPGA core, including one processing system, by using the addNewFPGACore and addNewProcessingSystem methods, respectively.

fpgaCoreName = 'PL1';
fpgaCoreObj = addNewFPGACore(hwObj,fpgaCoreName);
fpgaCoreObj.Vendor = 'Xilinx';
fpgaCoreObj.Family = 'MPSOC';
fpgaCoreObj.JTAGChainPosition = 1;
fpgaCoreObj.PartNumber = 'xczu7ev-ffvc1156-2-e';

processingSystemObj = addNewProcessingSystem(...
    fpgaCoreObj,...                             % FPGA Core Object
    'ProcessingSystem'...                       % Processing system name
processingSystemObj.TCLFile = ['$(TARGET_ROOT)/tcl/','ZCU106PS.tcl'];
processingSystemObj.ClockOutputPort = 'zynq_ultra_ps/pl_clk0';
processingSystemObj.ClockOutputFrequency = 99.990005;
processingSystemObj.ResetOutputPort = 'zynq_ultra_ps/pl_resetn0';
processingSystemObj.MasterInterfacePort = 'zynq_ultra_ps/M_AXI_HPM0_FPD';
processingSystemObj.MasterInterfaceClockPort = 'zynq_ultra_ps/maxihpm0_fpd_aclk';
processingSystemObj.SlaveInterfacePort = 'zynq_ultra_ps/S_AXI_HPC0_FPD';
processingSystemObj.SlaveInterfaceClockPort = 'zynq_ultra_ps/saxihpc0_fpd_aclk';
processingSystemObj.SlaveInterfaceDataWidth = 128; % data width of slave interface
processingSystemObj.InterruptInterfacePort = 'zynq_ultra_ps/pl_ps_irq0';

% constrain the frequency of the clock which drives slave interface clock port.
processingSystemObj.SlaveInterfaceFrequencyMinMax = [1 200]; 

The port name defined in the soc.sdk.ProcessingSystem object can be obtained from your implemented processing system IP in Vivado® block design. The above code defines a processing system as shown in this diagram. Specify the port name with corresponding block design pin name. Export the Vivado design to TCL file, ZCU106PS.tcl.

Add Memory Information

Memory in an soc.sdk.Hardware object is defined by an soc.sdk.Memory object. The Memory object must set the Size property to uniquely allocate a region of memory from the external DDR memory.

The following code shows how to define a 1024 MB region of external memory using the addNewMemory method.

memoryObj = addNewMemory(...
    hardwareObj,...     % Hardware object
    'DDRMEM'...         % Memory name
memoryObj.Size = 1024;  % 1024 (MB)

Add Clock and Reset Information

The system clock and hardware board reset in a soc.sdk.Hardware object are defined by soc.sdk.Clock and soc.sdk.Reset objects, respectively.

The following code shows how to add a system clock with frequency of 300 MHz using the addNewClock method.

clkObj = addNewClock(hardwareObj,'sys_clk');
clkObj.Pins = ["AJ12","AH12"];
clkObj.Frequency = 300;
clkObj.IOStandard = 'IOSTANDARD DIFF_SSTL12';

The following code shows how to add a system reset using the addNewReset method.

rstObj = addNewReset(hardwareObj,'sys_rst');
rstObj.Pin = 'G13';
rstObj.IOStandard = 'IOSTANDARD LVCMOS18';
rstObj.ActiveHigh = true;

Add Device I/O Information

I/O devices in an soc.sdk.Hardware object are defined by the I/O device objects, including soc.sdk.LED, soc.sdk.PushButton, and soc.sdk.DIPSwitch objects. Each I/O device object has a Pin and IOStandard properties that define the behavior of the connected pin on the hardware.

The following code show how to add an soc.sdk.LED object to the soc.sdk.Hardware object using the addNewLED method.

ledObj = addNewLED(...
ledObj.Pin = "AL11";
ledObj.IOStandard = 'IOSTANDARD LVCMOS12';

For models that use this hardware board, the LED is displayed as a port and properties of LED block. A similar relation occurs between the soc.sdk.PushButton, and soc.sdk.DIPSwitch objects and the Push Button and DIP Switch blocks.

Map Hardware Board to the Board Support

After adding all the desired properties to the hardware board, the hardware board can be added to the board support object. The following code shows how to add the soc.sdk.Hardware object to soc.sdk.BoardSupport object by using the map method.

map(boardSupportObj,hardwareObj,'My SoC Hardware Board');

After mapping the hardware board, you can test that the hardware board has been registered successfully. The following code shows how to test the hardware registration.


See Also

| | | |

Related Topics