Skip to main content
Version: 4.x

Create virtual SoC model

ZVB is a SoC modeling tool which facilitates SoC architecture exploration and optimization. With rich built-in components, it can take you on a journey from architecture or idea to a virtual SoC model.

Quick start

To get up and running with ZVB as quickly as possible, you can use the following simple example to learn how to create virtual board with built-in components and run ELF on your work.

  1. Create a virtual board

    A new board can be created using the new-virtual-board-button (New Virtual Board) button, or select File > New Virtual Board from main menu. Name the virtual board file Demo. Define its description, vendor and other properties according to your need. Set frequencies as 1000 and click Create. The new board will be listed under custom node in Virtual Board Navigator.

    new-virtual-board-1

    new-virtual-board-2

  2. Add components

    ZVB allows you to create a virtual board that can run ELF with a couple of built-in components and connections. You can find all components in Component Navigator. All the built-in components can be placed on canvas by dragging and dropping them. Just click and drag InOrder5StagesCPU (CPU), NonCoherentXBar (memory bus) and SimpleMemoryModel (memory) from navigator and drop them on canvas.

    Drag and drop components on canvas
  3. Connect the components you selected

    You can create connectivity between components by drawing a wire from one component's output pin to another component's input pin, which is referred to as logical connectivity. To define connectivity among three components, draw wire from each out pin of InOrder5StagesCPU to each in pin of Membus, and then draw a wire from out pin of Membus to in pin of Memory. You need to delete all redundant ports in Port view to ensure the validity of your virtual board.

    Connect the components
  4. Define component property

    To delete redundant ports of memory bus, click Membus in canvas. Properties of a placed object selected in canvas can be changed in right panel. Since Memory component has only one in pin, click delete button to reduce the number of out pins of Membus to one.

    Ensure that the memory address range of the Memory component is set to 0x0:0x100000000.

  5. Run ELF on your virtual board

    To run ELF on your virtual board, find the Demo board in Virtual Board Navigator and select Run ELF from Demo board's right-click menu. In the invoked dialog, point to the executable file(here we use HelloWorld) in ELF File Path and click Run.

You can check the output in Run Console.

User interface

The SoC modeling tool ZVB provides a convenient and explicit user interface that allows you to create and edit virtual boards.

  • Toolbar: The toolbar contains commonly used commands in ZVB. Move your cursor on each button to get the tooltips.
  • Left-hand side panel: It contains Virtual Board Navigator, Component Navigator and Running Virtual Board Navigator views and interactive buttons to assist you while working on your components or boards. You may use Ctrl+F to perform quick research.
  • Main editor: The main area to edit your virtual board in canvas.
  • Right-hand side panel: Properties and ports of a placed object selected in canvas can be changed in right-hand side panel.

Virtual Board Navigator, Component Navigator and Running Virtual Board Navigator views are listed in left-hand side panel. You can control the default visibility of them with more-action-button (More Actions...) button in the up-right corner.

All built-in and custom components displayed in Component Navigator and categorized by their type. To perform a straightforward search, click collapse-all-button (Collapse All) button to check which kinds of component you want and unfold that node to find one you like. You may use Ctrl+F to perform quick research.

You can also add a "source" category to distinct built-in and custom component. Right-click component type node and select Group by to invoke the level settings dialog. Add the "source" to Selected Type List and click OK.

The structure changes will be shown in the tree within the component navigator panel. built-in and custom were added as subnode under CPU type component.

You can also add category for virtual board navigator. Right-click blank area in virtual board navigator and select Group by to invoke the level settings dialog. Add categories to Selected Type List and define their levels by arrow.

The structure changes will be shown in the tree within the virtual board navigator panel. All boards will be categorized by source at top-level node and vendor at subnode.

tip

Component has fixed top-level category of component type, while virtual board can be categorized in all levels.

Design editor

Design editor is the main area to edit your virtual board in canvas. You can add, connect, manipulate and configure all components to explore SoC architecture and create a virtual board design.

The following list includes the most helpful operations and shortcuts on canvas, which help you control design editor conveniently.

Canvas-related Operation and Shortcuts
Control canvasOperation or keyboard shortcut
Navigate through the canvasRight-click and drag in any direction to move the canvas around
Zoom inHover mouse cursor on canvas, press Ctrl and scroll up
Zoom outHover mouse cursor on canvas, press Ctrl and scroll down
Zoom to fitHover mouse cursor on canvas, right click and select Zoom to fit
UndoFocus on canvas and press Ctrl+Z
RedoFocus on canvas and press Ctrl+Shift+Z
SaveFocus on canvas and press Ctrl+S

Property and port

As the image below, Property and Port view in right-hand side panel provides editing access to the properties of objects in canvas. The panel dynamically determines its content based on the object that is currently selected and presents specific properties and settings that relate to that object.

Hover the mouse cursor over the help-info-button to get help information of each property. In the Property region of the panel, you can control all properties of selected object. In the Port options region, you can add or delete pins of selected object placed on canvas.

Customize virtual board

ZVB allows you to create a virtual board based on built-in virtual board or construct your design from scratch.

  • New virtual board: A blank canvas can be created using the new-virtual-board-button (New Virtual Board) button, or select File > New Virtual Board from main menu. Define the virtual board name, description, frequencies and other properties in wizard and click Create.
  • Duplicate existing board: Right-click an existing board in Virtual Board Navigator and select Duplicate. Redefine the virtual board name, description, frequencies and other properties and click Create.

The canvas opened in design editor and you can find the board listed under custom node (if there is not custom node, refer to customize category level in Virtual Board Navigator.

Layers and components

ZVB provides two layers to construct your virtual Board design, which are SoC and CPU layer.

  • SoC layer

    Connect CPU with other peripheral components. For example, Bus, Memory, Interrupt-controller, Net and Disk, etc.

    The most simple board only needs three built-in components of CPU, Membus and Memory, as the demo in Quick start. You can add other Peripherals, such as Uart, or add PLIC to manage the interrupt of Uart, Disk, Ethernet and other devices.

  • CPU layer

    Define the pipeline in CPU layer.

    You can find all CPU internal components in datapath. The commonly used components are listed in the below table.

    CPU layer Components
    ComponentsDescription
    PCRegUse to create instructions.
    FetchUse to fetch instructions from memory.
    RegfileUse to read and write to registers.
    VPUUse to execute vector instructions.
    EXUUse to perform scalar instructions and generate addresses for memory instructions.
    LSUUse to execute memory access instructions.
    CommitSet the instruction to a completed state and update the instruction counters.
    WriteBackUse to write instruction result back to register.
    ExceptionUse to handle exceptions and interrupts.

You can enter into internal of CPU-type component to construct its pipeline by right-clicking a CPU component and selecting Open. To return to SoC layer, just right-click blank area and select Close.

Navigate through SoC and CPU layers

All components are listed in Component Navigator. Press Ctrl+F to perform a straightforward search and find one you like. Just click and drag the component you want from navigator and drop them on canvas. You can control the component in canvas by:

Control components in canvas
  • Placement: Click and drag the selected component to move it around, then drop it on canvas.

  • Delete: Click component and press Delete.

  • Multi-selection: use Ctrl to select multiple components, or click and drag over them.

  • Zoom: Hover your mouse cursor over a component until a black point appears on bottom-right. Click and drag the black point to zoom in and zoom out.

  • Duplicate: Right-click a object and select Copy and Paste it on another right-click. You need to drag the new object from the original one.

  • Change ports location: Click component and press shift + R.

  • layer switch: Click CPU type component, press Enter and Esc.

  • Save as template: Right-click the object in canvas and select Save as Template, ensure the component properties in dialog and create. The component will be listed in Component Navigator according its type.

Define component properties

Properties of a placed object selected in canvas can be changed in right-hand side panel. The panel dynamically determines its content based on the object that is currently selected and presents specific properties and settings that relate to that object.

All changes will be synchronized with object in canvas. As the gif below, you can change component's name, address range and other properties in Property view.

Define component properties

Microarchitecture of CPU component

You can edit the properties of CPU type component to define which ISA it supports.

  1. Click CPU type component to invoke its property settings.
  2. Select the ISA and extensions it supports from Base Instruction Set and Extensions.

You can also define which types of instruction operations are allowed to be performed on Execute type component. ZVB provides support of custom instructions in ZIGen. You need to specify the function unit that you select for your custom instructions to Execute component in CPU layer. Please refer to the following table

Available Function Units
Function UnitDescription
IntAluInteger Arithmetic Logic Unit
IntBruInteger Branch Unit
IntMultInteger Multiplication Unit
IntDivInteger Division Unit
FloatAddFloating Point Addition Unit
FloatCmpFloating Point Comparison Unit
FloatCvtFloating Point Conversion Unit
FloatMultFloating Point Multiplication Unit
FloatMultAccFloating Point Multiply-Accumulate Unit
FloatDivFloating Point Division Unit
FloatMiscFloating Point Miscellaneous Unit
FloatSqrtFloating Point Square Root Unit
MemReadMemory Read Unit
MemWriteMemory Write Unit
FloatMemReadFloating Point Memory Read Unit
FloatMemWriteFloating Point Memory Write Unit
VPUVector Processing Unit
SIMDSingle Instruction, Multiple Data
built-inInclude all function unit types except Cus
Cus0/Cus1/Cus2/Cus3/Cus4Reserved for user customization
  1. Click EXU0 component to invoke its property settings.
  2. Click add-ports-buttonto add Op List Forms.
  3. Select Op Desc from pull-down box.
  4. Select function unit for EXU0 component.

The function unit also should be specified to your custom instruction from the drop-down box in ZIGen view. To create custom instructions, please refer to custom extension.

Define ports and connect the components

You can control the pins of component by adding or deleting button in Port view. Click add-ports-button (add) or delete-ports-button (delete) to control the number of pins of component. A grey button means the selected object port is fixed and can not be controlled by users.

tip

You need to delete all redundant ports that can be controlled in Port view while not be connected to ensure the validity of your virtual board.

Currently, there are four types of ports provided. Each of them has different direction of in, out and inout, where only the same type of out port can be connected to the same type of in port. Inout port has both input and output characteristics. Only Virt Port has inout direction.

Description of Port Type
Port TypeDescriptionUsage in components
Memory PortUse to transmit data and requests and for accessing memory.1.Bus or Peripherals : receive memory access requests and processes feedback; 2. Fetch and LSU : require memory access.
Interrupt PortUse to transmit interrupt signals.All components that can generate and receive interrupts.
Instruction PortUsed to transmit instructions and related control signals.All components under datapatch category.
Virt PortServes sa a logical port to connect internal and external component of CPU.Only CPU type component : for example, the Fetch component inside the CPU access memory through Virt Port.

You can create connectivity between components by drawing a wire from one component's out type pin to another component's in type pin, which is referred to as logical connectivity.

Connect the components and delete redundant ports

Run ElF on virtual board

To run ELF on a completed or built-in virtual board, right-click a virtual board in navigator and select Run ELF. In the invoked dialog, point ZStudio to the executable file in ELF File Path and click Run. Check the run output in Run Console.