basm

package
v0.0.0-...-fe19dca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

README

Basm

Basm is the BondMachine assembler. It is a tool that translates a BondMachine assembly code into a BondMachine cluster object file (BCOF) or into a BondMachine architecture file. Basm is a tool that is part of the BondMachine toolchain.

Basm is very different from traditional assemblers. In the default case, the target architecture of a basm instance does not yet exists when it is running. The creation of the architecture is part of the assembling process. The architecture is created by the assembler itself by looking at the code and at the metadatas. The assembler creates the architecture and fills it with the data collected during the process. This is a novel concept of the BondMachine.

One or more .basm files contain the code to be compiled in an existing BM or to produce a suitable one. Basm files not only contain the code but also the metadatas that are used to define the architecture. The metadatas are used to define the SOs, the CPs and the BM itself. The metadatas are defined by using the %meta directives.

The page Basm File Structure contains a detailed description of the structure of a .basm file. The page Basm Instructions contains a detailed description how to write instructions and I/O objects in a .basm file. The page Basm Internals contains information about the internals of the assembler. The single instructions documentation is available in the BASM Assembly Reference.

Usage

basm [options] [input files]

where options are:

Usage of basm:
  -activate-optimizations string
        List of comma separated optional optimizations to activate (default: none, everything: all)
  -activate-passes string
        List of comma separated optional passes to activate (default: none)
  -bminfo-file string
        Load additional information about the BondMachine
  -bo string
        BCOF Output file
  -bondmachine string
        Load a bondmachine JSON file
  -chooser-force-same-name
        Force the chooser to use the same name for the ROM and the RAM
  -chooser-min-word-size
        Choose the minimum word size for the chooser
  -d    Verbose
  -deactivate-passes string
        List of comma separated optional passes to deactivate (default: none)
  -disable-dynamical-matching
        Disable the dynamical matching
  -dump-requirements string
        Dump the requirements of the BondMachine in a JSON file
  -getmeta string
        Get the metadata of an internal parameter of the BondMachine
  -linear-data-range string
        Load a linear data range file (with the syntax index,filename)
  -list-optimizations
        List the available optimizations
  -list-passes
        List the available passes
  -o string
        BondMachine Output file
  -si string
        Load a symbols JSON file
  -so string
        Symbols Output file
  -v    Verbose

Documentation

Index

Constants

View Source
const (
	FIRSTLINE = -2
	LASTLINE  = -3
	NULLLINE  = -1
)
View Source
const (
	IOLINK = uint8(0) + iota
	FILINK
)
View Source
const (
	LAST_PASS = passSymbolsResolver
)
View Source
const (
	OPT_INVALID_UNUSED = 0 + iota
)

Variables

This section is empty.

Functions

func GetPassMnemonic

func GetPassMnemonic() map[uint64]string

func IsOptionalPass

func IsOptionalPass() map[uint64]bool

func Needed_bits

func Needed_bits(num int) int

Types

type BasmChunk

type BasmChunk struct {
	// contains filtered or unexported fields
}

func (*BasmChunk) String

func (m *BasmChunk) String() string

type BasmFragment

type BasmFragment struct {
	// contains filtered or unexported fields
}

func (*BasmFragment) String

func (m *BasmFragment) String() string

type BasmInstance

type BasmInstance struct {
	*bminfo.BMinfo
	*bmconfig.BmConfig
	// contains filtered or unexported fields
}

func (*BasmInstance) ActivateOptimization

func (bi *BasmInstance) ActivateOptimization(opt string) error

func (*BasmInstance) ActivePass

func (bi *BasmInstance) ActivePass(active uint64) bool

func (*BasmInstance) Alert

func (bi *BasmInstance) Alert(logline ...interface{})

Alert helper function

func (*BasmInstance) Assembler2BCOF

func (bi *BasmInstance) Assembler2BCOF() error

Assembler2BCOF transform an assembled instance into a BCOF file

func (*BasmInstance) Assembler2BondMachine

func (bi *BasmInstance) Assembler2BondMachine() error

Assembler2BondMachine transform an assembled instance into a BCOF file

func (*BasmInstance) BasmInstanceInit

func (bi *BasmInstance) BasmInstanceInit(bm *bondmachine.Bondmachine)

func (*BasmInstance) CodeChoice

func (bi *BasmInstance) CodeChoice(rSize uint8, i int, sh string) error

func (*BasmInstance) CreateConnectingProcessor

func (bi *BasmInstance) CreateConnectingProcessor(rSize uint8, cp *bmline.BasmElement, procid int, romCode string, romData string, ramCode string, ramData string, execMode string) (*procbuilder.Machine, error)

func (*BasmInstance) Debug

func (bi *BasmInstance) Debug(logline ...interface{})

Debug helper functrion

func (*BasmInstance) DumpRequirements

func (bi *BasmInstance) DumpRequirements() bmreqs.ExportedReqs

func (*BasmInstance) GetBCOF

func (bi *BasmInstance) GetBCOF() *bcof.BCOFEntry

func (*BasmInstance) GetBondMachine

func (bi *BasmInstance) GetBondMachine() *bondmachine.Bondmachine

func (*BasmInstance) GetEndpoints

func (bi *BasmInstance) GetEndpoints(t uint8, name string) (in endpoint, out endpoint, err error)

func (*BasmInstance) GetFI

func (bi *BasmInstance) GetFI(finame string) (int, *bmline.BasmElement, error)
func (bi *BasmInstance) GetLinks(t uint8, name string, index string, dir string) ([]string, error)

func (*BasmInstance) GetMeta

func (bi *BasmInstance) GetMeta(req string) (string, error)

func (*BasmInstance) Info

func (bi *BasmInstance) Info(logline ...interface{})

Info helper function

func (*BasmInstance) LLVMGetLocalID

func (bi *BasmInstance) LLVMGetLocalID(inst value.Value) (int64, error)

func (*BasmInstance) ParseAssemblyDefault

func (bi *BasmInstance) ParseAssemblyDefault(filePath string) error

func (*BasmInstance) ParseAssemblyFile

func (bi *BasmInstance) ParseAssemblyFile(filePath string, parseFunction func(*BasmInstance, string, uint32) error) error

ParseAssemblyFile opens the actual assembly file and call a parse function on every line with the underline BasmInstance loaded

func (*BasmInstance) ParseAssemblyLLVM

func (bi *BasmInstance) ParseAssemblyLLVM(filePath string) error

func (*BasmInstance) ParseAssemblyString

func (bi *BasmInstance) ParseAssemblyString(text string, parseFunction func(*BasmInstance, string, uint32) error) error

ParseAssemblyString opens the actual assembly file and call a parse function on every line with the underline BasmInstance loaded

func (*BasmInstance) ParseAssemblyStringDefault

func (bi *BasmInstance) ParseAssemblyStringDefault(text string) error

func (*BasmInstance) PrintInit

func (bi *BasmInstance) PrintInit()

func (*BasmInstance) RunAssembler

func (bi *BasmInstance) RunAssembler() error

Run the assembler

func (*BasmInstance) SetActive

func (bi *BasmInstance) SetActive(pass string) error

func (*BasmInstance) SetDebug

func (bi *BasmInstance) SetDebug()

SetDebug sets the debug flag on a BasmInstance

func (*BasmInstance) SetVerbose

func (bi *BasmInstance) SetVerbose()

SetVerbose sets the verbose flag on a BasmInstance

func (*BasmInstance) String

func (bi *BasmInstance) String() string

func (*BasmInstance) UnsetActive

func (bi *BasmInstance) UnsetActive(pass string) error

func (*BasmInstance) Warning

func (bi *BasmInstance) Warning(logline ...interface{})

Warning helper function

type BasmMacro

type BasmMacro struct {
	// contains filtered or unexported fields
}

func (*BasmMacro) String

func (m *BasmMacro) String() string

type BasmSection

type BasmSection struct {
	// contains filtered or unexported fields
}

func (*BasmSection) String

func (m *BasmSection) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL