Documentation ¶
Index ¶
- type Branch
- type Mesh
- func (m *Mesh) CreateNode(nop bool) *MeshNode
- func (m *Mesh) InsertTraceLogIntoMesh(tles []tracelog.TraceLogEntry, FirmwareOptions map[string]uint64) error
- func (m *Mesh) LastNode() *MeshNode
- func (m *Mesh) MergeMeshNodesAndUnlink(b *MeshNode, keep *MeshNode)
- func (m *Mesh) MeshNodeFromTraceLogEntry(tle tracelog.TraceLogEntry) (*MeshNode, error)
- func (m *Mesh) OptimiseMeshByAddingNops() error
- func (m *Mesh) OptimiseMeshByRemovingFirmwareOptions(allFirmwareOptions map[string][]uint64) error
- func (m *Mesh) OptimiseMeshByRemovingNodes() error
- func (m *Mesh) WriteDot(filename string) error
- type MeshNode
- func (mn *MeshNode) AnyPathesContainNode(find *MeshNode) bool
- func (mn *MeshNode) CommonMergePoint() *MeshNode
- func (mn *MeshNode) FirstPath() []*MeshNode
- func (mn *MeshNode) LenFirstPath() uint
- func (mn *MeshNode) NextPath(lastPath []*MeshNode) []*MeshNode
- func (mn *MeshNode) OptimiseNodeByRemovingFirmwareOptions(allFirmwareOptions map[string][]uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mesh ¶
type Mesh struct { Start MeshNode // Pathes is incremented on each merge Pathes uint64 Nodes []*MeshNode // IDcounter, increment on new MeshNode ID uint64 }
a Mesh connects Nodes, using one or more pathes
func (*Mesh) CreateNode ¶
CreateNode - Create a new node, but don't add it to the mesh
func (*Mesh) InsertTraceLogIntoMesh ¶
func (m *Mesh) InsertTraceLogIntoMesh(tles []tracelog.TraceLogEntry, FirmwareOptions map[string]uint64) error
InsertTraceLogIntoMesh - Inserts a complete tracelog into the mesh It first creates a new branch and then merges the branch into the mesh using LCS Every created node on the branch gets assigned a FirmwareOptions slice On merge FirmwareOptions slices are also merged
func (*Mesh) LastNode ¶
LastNode - returns the last node in a mesh The last node is the last element of the likeliest path
func (*Mesh) MergeMeshNodesAndUnlink ¶
MergeMeshNodesAndUnlink - merge b into m
func (*Mesh) MeshNodeFromTraceLogEntry ¶
func (m *Mesh) MeshNodeFromTraceLogEntry(tle tracelog.TraceLogEntry) (*MeshNode, error)
MeshNodeFromTraceLogEntry - Generate mesh node ftom tracelog entry
func (*Mesh) OptimiseMeshByAddingNops ¶
OptimiseMeshByAddingNops - Try to insert nops to reduce the number of edges This leads to prettier code generation
func (*Mesh) OptimiseMeshByRemovingFirmwareOptions ¶
OptimiseMeshByRemovingFirmwareOptions - If a node has all options a FirmwareOption can have, remove it as it doesn't depend on the config
func (*Mesh) OptimiseMeshByRemovingNodes ¶
OptimiseMeshByRemovingNodes - Try to remove duplicated nodes. The branch merging only working for all pathes below the branch point Start at the end of the mesh and merge duplicated nodes into one
type MeshNode ¶
type MeshNode struct { // Id is incremented for each node added. It's unique in the mesh. Id uint64 // Propability is incremented with each merged path if the node is part // of the merged path. By dividing it with Mesh.Pathes it gives the // propability Propability uint64 Next, Prev []*MeshNode Hash string TLE tracelog.TraceLogEntry FirmwareOptions []map[string]uint64 // a Noop meshnode doesn't generate code. It just makes the code generation prettier IsNoop bool }
MeshNode - Describes a node in the Mesh
func (*MeshNode) AnyPathesContainNode ¶
AnyPathesContainNode - returns true if one of the pathes contains the meshnode to find
func (*MeshNode) CommonMergePoint ¶
CommonMergePoint - returns the merge point of all branches starting from this node
func (*MeshNode) FirstPath ¶
FirstPath - returns first path starting at the children of the given node
func (*MeshNode) LenFirstPath ¶
LenFirstPath - Returns the length of the first path through the mesh