Skip to content

Latest commit

 

History

History
105 lines (83 loc) · 2.4 KB

File metadata and controls

105 lines (83 loc) · 2.4 KB

Configuration

QBox uses the SystemC CCI (Configuration, Control, and Inspection) standard for configuration, with Lua files as the primary configuration language.

Command-Line Parameters

# Load a Lua configuration file
--gs_luafile <FILE.lua>
# or
-l <FILE.lua>

# Set an individual parameter
--param path.to.param=<value>
# or
-p path.to.param=<value>

Order matters: the last option on the command line to set a parameter takes precedence.

Lua Configuration

Platform configurations are written in Lua. A typical configuration defines a hierarchy of modules with their parameters and socket bindings:

platform = {
    router = {
        moduletype = "router"
    },
    memory = {
        moduletype = "gs_memory",
        target_socket = {
            address = 0x80000000,
            size = 0x100000000,
            bind = "&router.initiator_socket"
        }
    },
    qemu_inst = {
        moduletype = "QemuInstance"
    },
    cpu_0 = {
        moduletype = "cpu_arm_cortexA76",
        mem = {bind = "&router.target_socket"}
    }
}

YAML Configuration

If you prefer YAML, the lyaml library provides a bridge. Install it from https://github.com/gvvaughan/lyaml.

The following Lua snippet loads a conf.yaml file:

local lyaml = require "lyaml"

function readAll(file)
    local f = assert(io.open(file, "rb"))
    local content = f:read("*all")
    f:close()
    return content
end

print "Loading conf.yaml"
yamldata = readAll("conf.yaml")
ytab = lyaml.load(yamldata)
for k, v in pairs(ytab) do
    _G[k] = v
end
yamldata = nil
ytab = nil

ConfigurableBroker

The gs::ConfigurableBroker self-registers in the SystemC CCI hierarchy. It inherits from the standard CCI consuming broker and adds the ability to explicitly hide parameters from the parent broker.

Instantiation Modes

1. Private broker: ConfigurableBroker()

When constructed with no initialized parameters, all parameters held within this broker are treated as private (hidden from the parent broker).

2. Selective broker: ConfigurableBroker({{"key1","value1"}, {"key2","value2"}, ...})

Sets and hides the listed keys. All other keys are passed through (exported), making the broker invisible for unlisted parameters. This is useful for structural parameters.

A pass-through broker can be created with an empty list: ConfigurableBroker({}). This provides a local broker without hiding any parameters.