bondgo

package
v0.0.0-...-3be6dbe Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_REGS     = 65536
	MAX_MEMORY   = 65536
	MAX_CHANNELS = 65536
	MAX_INPUTS   = 16
	MAX_OUTPUTS  = 16
	MAXPEERID    = uint32(10000)
)
View Source
const (
	TR_PROC = uint8(0) + iota
	TR_CHAN
	TR_SHAREDMEM
	TR_EXIT
)
View Source
const (
	C_OPCODE = uint8(0) + iota
	C_REGSIZE
	C_INPUT
	C_OUTPUT
	C_ROMSIZE
	C_RAMSIZE
	C_SHAREDOBJECT
	C_CONNECTED
	C_DEVICE
)
View Source
const (
	REQ_REMOVE = uint8(0) + iota // Removes the resoure from the local used list, if associated with a global one the global is never removed
	REQ_NEW                      // New variable request (and eventually attach to a global one)
	REQ_ATTACH                   // Attach a local var to a global one
	REQ_EXIT
)
View Source
const (
	ANS_OK = uint8(0) + iota
	ANS_FAIL
)
View Source
const (
	REGISTER = uint8(0) + iota
	MEMORY
	INPUT
	OUTPUT // Used only in assignment
	CHANNEL
	SHAREDMEMORY
)
View Source
const (
	T_NAMED = uint8(0) + iota
	T_CHAN
	T_STAR
	T_STRUCT
)
View Source
const (
	I_NIL = 0
)
View Source
const (
	S_NIL = ""
)

Variables

This section is empty.

Functions

func AllInit

func AllInit(gornum int)

func AllWait

func AllWait()

func Assembly_2_Processor

func Assembly_2_Processor(rsize int, asmcode []string) (*procbuilder.Machine, error)

func MultiAsm2BondMachine

func MultiAsm2BondMachine(rsize int, aafile *Abs_assembly) (*bondmachine.Bondmachine, error)

func Needed_bits

func Needed_bits(num int) int

func Same_Type

func Same_Type(t1 *VarType, t2 *VarType) bool

Variable type equality

func Sequence_to_0

func Sequence_to_0(start string) ([]string, uint8)

func Void

func Void(interface{})

Types

type Abs_assembly

type Abs_assembly struct {
	ProcProgs []string
	Bonds     []string
}

type BondgoCheck

type BondgoCheck struct {
	// The results
	*BondgoResults // The generated objects

	// Globally
	*BondgoConfig // Global compiler config

	*BondgoRequirements // The pointer to the requirements struct
	*BondgoRuninfo      // Running data

	*BondgoMessages // Compiler messages and errors

	*BondgoFunctions // The map of declared functions in all scopes

	Used    chan UsageNotify // Used to notify the used resource
	Reqs    chan VarReq      // Variable request
	Answers chan VarAns      // Variable response

	// Scope wide
	Outer *BondgoCheck // The previous scope
	Clean *BondgoCheck // The scope that need to be clean by its next brother aka when the scope ends

	Vars    map[string]VarCell // The map of variable in the current scope
	Returns []VarCell          // Returns for functions call

	CurrentLoop   string
	CurrentSwitch string
	CurrentDevice string

	CurrentRoutine int // Aka current processor
}

func (*BondgoCheck) Create_Bondmachine

func (bg *BondgoCheck) Create_Bondmachine(rsize int, filter string) (*bondmachine.Bondmachine, *bondmachine.Residual, error)

func (*BondgoCheck) Create_Connecting_Processor

func (bg *BondgoCheck) Create_Connecting_Processor(rsize int, procid int) (*procbuilder.Machine, bool)

func (*BondgoCheck) Create_Etherbond_Cluster

func (bg *BondgoCheck) Create_Etherbond_Cluster(rsize int, extc *etherbond.Cluster) (*etherbond.Cluster, []uint32, []*bondmachine.Bondmachine, []*bondmachine.IOmap, []*bondmachine.Residual, error)

func (*BondgoCheck) Create_Udpbond_Cluster

func (bg *BondgoCheck) Create_Udpbond_Cluster(rsize int, extc *udpbond.Cluster) (*udpbond.Cluster, []uint32, []*bondmachine.Bondmachine, []*bondmachine.IOmap, []*bondmachine.Residual, error)

func (*BondgoCheck) Expr_eval

func (bg *BondgoCheck) Expr_eval(n ast.Expr) ([]VarCell, bool)

func (*BondgoCheck) Visit

func (bg *BondgoCheck) Visit(n ast.Node) ast.Visitor

type BondgoConfig

type BondgoConfig struct {
	Debug          bool
	Verbose        bool
	Mpm            bool
	MaxRegs        int
	Rsize          uint8
	Basic_type     string
	Basic_chantype string
	Cascading_io   bool
}

func (*BondgoConfig) In_debug

func (db *BondgoConfig) In_debug() bool

type BondgoFunctions

type BondgoFunctions struct {
	*BondgoConfig
	*BondgoMessages
	Functions map[string]FunctCell
}

func (*BondgoFunctions) Init_Functions

func (fn *BondgoFunctions) Init_Functions(cfg *BondgoConfig, ms *BondgoMessages)

func (*BondgoFunctions) String

func (fn *BondgoFunctions) String() string

func (*BondgoFunctions) Visit

func (fn *BondgoFunctions) Visit(n ast.Node) ast.Visitor

type BondgoMessages

type BondgoMessages struct {
	Config       *BondgoConfig
	Error_status bool     // The compiler general status
	Message_list []string // The list of compiler messages
}

func (*BondgoMessages) Dump_log

func (b *BondgoMessages) Dump_log() string

func (*BondgoMessages) Init_Messages

func (b *BondgoMessages) Init_Messages(cfg *BondgoConfig)

func (*BondgoMessages) Is_faulty

func (b *BondgoMessages) Is_faulty() bool

func (*BondgoMessages) Log

func (b *BondgoMessages) Log(line string)

func (*BondgoMessages) Set_faulty

func (b *BondgoMessages) Set_faulty(line string)

func (*BondgoMessages) Warning

func (b *BondgoMessages) Warning(line string)

type BondgoRequirements

type BondgoRequirements struct {
	Config *BondgoConfig // Global compiler config
	Procr  map[int]*ProcRequirements
	IOr    map[int]*IORequirements
	Chanr  map[int]*ChanRequirements
	Shrdr  map[int]*SharedMemRequirements
}

func (*BondgoRequirements) Abstract_assembler

func (bg *BondgoRequirements) Abstract_assembler(rsize int, asmcode []string, used chan UsageNotify) error

func (*BondgoRequirements) Dump_Requirements

func (reqmnt *BondgoRequirements) Dump_Requirements() string

func (*BondgoRequirements) Init_Requirements

func (reqmnt *BondgoRequirements) Init_Requirements(cfg *BondgoConfig)

func (*BondgoRequirements) Usage_Monitor

func (reqmnt *BondgoRequirements) Usage_Monitor(useditem chan UsageNotify, usagedone chan bool)

type BondgoResults

type BondgoResults struct {
	Config  *BondgoConfig
	Proc    *procbuilder.Arch
	Bmach   *bondmachine.Bondmachine
	Program map[int]*BondgoRoutine // The generated assembly
}

func (*BondgoResults) Checker

func (rs *BondgoResults) Checker(proc_id int, ck string) bool

func (*BondgoResults) CountLines

func (rs *BondgoResults) CountLines(proc_id int) int

func (*BondgoResults) GetProgram

func (rs *BondgoResults) GetProgram(proc_id int) []string

func (*BondgoResults) Init_Results

func (rs *BondgoResults) Init_Results(cfg *BondgoConfig)

func (*BondgoResults) Replacer

func (rs *BondgoResults) Replacer(proc_id int, from string, to string)

func (*BondgoResults) Shift_program_location

func (rs *BondgoResults) Shift_program_location(proc_id int, n int)

func (*BondgoResults) WriteLine

func (rs *BondgoResults) WriteLine(proc_id int, line string)

func (*BondgoResults) Write_assembly

func (rs *BondgoResults) Write_assembly(proc_id int) string

type BondgoRoutine

type BondgoRoutine struct {
	Lines []string
}

func (*BondgoRoutine) Append

func (p *BondgoRoutine) Append(line string)

func (*BondgoRoutine) Checker

func (p *BondgoRoutine) Checker(ck string) bool

func (*BondgoRoutine) Remove_program_location

func (p *BondgoRoutine) Remove_program_location()

func (*BondgoRoutine) Replacer

func (p *BondgoRoutine) Replacer(from string, to string)

func (*BondgoRoutine) Shift_program_location

func (p *BondgoRoutine) Shift_program_location(n int)

type BondgoRuninfo

type BondgoRuninfo struct {
	Config     *BondgoConfig // Global compiler config
	Used_cells map[int]VarCells
	IO         []IOInfo
	Channels   []ChanInfo
	SharedRAM  []SharedRAMInfo
}

func (*BondgoRuninfo) Init_Runinfo

func (ri *BondgoRuninfo) Init_Runinfo(cfg *BondgoConfig)

func (*BondgoRuninfo) Var_assigner

func (ri *BondgoRuninfo) Var_assigner(req chan VarReq, resp chan VarAns, useditem chan UsageNotify, assignerdone chan bool)

This goroutine assign or frees used memory within a processor

type ChanInfo

type ChanInfo struct {
	Global_id int
	Connected []int
	Readers   []int
	Writers   []int
}

bondmachine channels

type ChanRequirements

type ChanRequirements struct {
	Connected []int
}

Maybe a rewrite in term of SO (with interfaces) is need.

func (*ChanRequirements) Dump_Requirements

func (reqmnt *ChanRequirements) Dump_Requirements() string

type FunctArg

type FunctArg struct {
	Argname string
	Argtype *VarType
}

type FunctCell

type FunctCell struct {
	Inputs  []FunctArg
	Outputs []FunctArg
	Body    *ast.BlockStmt
}

The type to hold functions

func (*FunctCell) String

func (fc *FunctCell) String() string

type IOInfo

type IOInfo struct {
	Global_id int
	Inputs    []int
	Output    int
}

IO topology

type IORequirements

type IORequirements struct {
	Inputs_ids  []int
	Outputs_ids []int
}

func (*IORequirements) Dump_Requirements

func (reqmnt *IORequirements) Dump_Requirements() string

type Input

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

func (*Input) Make

func (i *Input) Make(idx int, val interface{})

func (*Input) Read

func (i *Input) Read() interface{}

type Output

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

func (*Output) Make

func (o *Output) Make(idx int)

func (*Output) Write

func (o *Output) Write(val interface{})

type ProcRequirements

type ProcRequirements struct {
	Opcodes       []string
	Registersize  int
	Inputs        int
	Outputs       int
	Romsize       int
	Ramsize       int
	SharedObjects []string
	Device        string
}

func (*ProcRequirements) Dump_Requirements

func (reqmnt *ProcRequirements) Dump_Requirements() string

type SharedMemRequirements

type SharedMemRequirements struct {
}

type SharedRAMInfo

type SharedRAMInfo struct {
	Global_id int
	Connected []int
}

bondmachine shared RAM

type UsageNotify

type UsageNotify struct {
	TargetType    uint8
	TargetId      int
	ComponentType uint8
	Components    string
	Componenti    int
}

type VarAns

type VarAns struct {
	AnsType uint8
	Cell    VarCell
}

type VarCell

type VarCell struct {
	Vtype          *VarType // The variable type
	Procobjtype    uint8    // 0 Register, 1 RAM, 2 output (notin vars) etc.
	Id             int      // Local (within the processor) reference to the object among objects of the same type
	Start_id       int      // Local (within the processor) reference to the object among objects of the same type (start data)
	End_id         int      // Local (within the processor) reference to the object among objects of the same type (end data)
	Global_id      int      // Global reference to the object among objects of the same type
	Start_globalid int      // Global reference to the object among objects of the same type (start data)
	End_globalid   int      // Global reference to the object among objects of the same type (end data)
}

The type to hold variables in processor objects (mem or registers or whatever) and in bondmachine objects

func (VarCell) String

func (m VarCell) String() string

VarCell to string

type VarCells

type VarCells []VarCell

type VarReq

type VarReq struct {
	ReqType      uint8
	Processor_id int
	Cell         VarCell
}

func (*VarReq) String

func (vr *VarReq) String() string

type VarType

type VarType struct {
	MainType uint8
	Name     string
	Values   []*VarType
}

func Type_from_ast

func Type_from_ast(spec ast.Node) (*VarType, error)

Type from ast

func Type_from_string

func Type_from_string(types string) (*VarType, error)

Type from string

func (*VarType) String

func (t *VarType) String() string

Vartype to String

Jump to

Keyboard shortcuts

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