Skip to content

CAPI2: Variables#765

Open
ArkoshEternal wants to merge 11 commits intoolofk:mainfrom
ArkoshEternal:fusesoc_var
Open

CAPI2: Variables#765
ArkoshEternal wants to merge 11 commits intoolofk:mainfrom
ArkoshEternal:fusesoc_var

Conversation

@ArkoshEternal
Copy link
Copy Markdown

CAPI2 Variables

Introducing flag-like variables feature discussed originally in #675

High Level Feature Description:

Add the ability to assign CAPI2 entries to a variable, denoted by a string which starts with $
Globally resolve variables either from defaults set in a target, or from CLI arguments

Change Details:

  • Add variables section to target which allows for the definition of int, string, or bool variables which can be defined as key-value pairs
  • Add support for new meta-character, $, which can be used in a manner similar to bash variables wherever a flag ternary operation can currently be used
  • Add new cli for fusesoc run, --var key=value , which can supplement target held variables
  • Add testing to ensure functionality of the variables infrastructure
  • Add variables to build_system documentation

Design Decisions

  • Add variables as coequal to flags instead of as redesigning flags as a data class to prevent any major re-writes of the flags system, although unifying is appealing at a later time
  • Intentionally did not fuse them with parameters because of parameters isolation to use in the backend rather than the front end

Pain Points Solved

  • ** Allows for upstream control of downstream generators**
  • Allows for less complex flag ternary trees downstream
  • Simplifies duplicated tool options (e.g. same command passed to vlogan/vhdlan and vcs in vcs simulations)
  • Gives end users more flexibility in implementing their vision

Considered Extensions

  • Allow for inline variable defaults (e.g. my_key: $my_value:=<default_value>)

The implementation was intentionally simple, happy to iterate on it more if there's specific pain points that can be solved in this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant