edif

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package edif Contains various structures, and functions related to the modification and parsing of EDIF (Electronic Design Interchange Format) files. This can be used for example to manipulate the netlist of a circuit which is produced by EDA tools, like Vivado.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(edif *Edif) error

Write Writes the contents specified in the EDIF structure back to the edif file from which it was previously parsed using the Read routine. If err = nil, the file was successfully written, otherwise an error is returned indicating the cause of failure.

Types

type Edif

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

Edif Models the EDIF file. Is essentially holding the whole tree of netlists.

func Read

func Read(filepath string) (*Edif, error)

Read Reads the contents of an edif file, translating it into an EDIF data structure. It returns the EDIF representation if succeeded, otherwise an error is returned indicating the cause of failure.

func (*Edif) FileName

func (edif *Edif) FileName() string

FileName Returns the file name of the currently examined netlist file.

func (*Edif) FilePath

func (edif *Edif) FilePath() string

FilePath Returns the path where the currently examined netlist file is stored.

func (*Edif) RootList

func (edif *Edif) RootList() *List

RootList Returns the root netlist, which contains all the other netlists.

type ElementType

type ElementType uint32

ElementType Represents a datatype present in the EDIF file.

const (
	// ListType Represents a component of the EDIF file.
	ListType ElementType = 1
	// StringType Represents a string present in the EDIF file.
	StringType ElementType = 2
	// IntegerType Represents an integer present in the EDIF file.
	IntegerType ElementType = 3
	// KeywordType Represents a keyword present in the EDIF file.
	KeywordType ElementType = 4
	// ListIdentifierType Represents the identifier of a component, present in the
	// EDIF file.
	ListIdentifierType ElementType = 5
	// UnknownType indicates that the type of datatype in the EDIF file, is
	// not yet known.
	UnknownType ElementType = 6
)

type Identifier

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

func CreateIdentifier

func CreateIdentifier(value string) *Identifier

func (*Identifier) DataType

func (edifIdentifier *Identifier) DataType() ElementType

func (*Identifier) Value

func (edifIdentifier *Identifier) Value() any

type Integer

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

func CreateInteger

func CreateInteger(value int) *Integer

func (*Integer) DataType

func (edifInteger *Integer) DataType() ElementType

func (*Integer) Value

func (edifInteger *Integer) Value() any

type Keyword

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

func CreateKeyword

func CreateKeyword(value string) *Keyword

func (*Keyword) DataType

func (edifKeyword *Keyword) DataType() ElementType

func (*Keyword) Value

func (edifKeyword *Keyword) Value() any

type List

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

func CreateList

func CreateList(
	keyword *Keyword, identifier *Identifier,
	values list.List,
) *List

func (*List) Children

func (edifList *List) Children() *list.List

func (*List) DataType

func (edifList *List) DataType() ElementType

func (*List) Identifier

func (edifList *List) Identifier() *Identifier

func (*List) InsertElement

func (edifList *List) InsertElement(
	element ListElement, after ListElement,
) error

InsertElement Inserts a new netlist element after the provided, new element. If err = nil, the element was inserted successfully, otherwise an error is returned indicating the cause of failure.

func (*List) Keyword

func (edifList *List) Keyword() *Keyword

func (*List) ListAllChildren

func (edifList *List) ListAllChildren() []*List

ListAllChildren Stores every component of the EDIF file into a slice of pointers by doing there is no requirement to know the nested order of the EDIF to access a specific component. It returns the slice of pointers to all the components.

func (*List) ListChildren

func (edifList *List) ListChildren() []ListElement

ListChildren Lists all the netlist components which belong to a parent component.

func (*List) PushElement

func (edifList *List) PushElement(element ListElement)

func (*List) RemoveElement

func (edifList *List) RemoveElement(element ListElement) error

RemoveElement Removes the netlist element provided. If succeeded err = nli, otherwise an error is returned indicating the cause of failure.

func (*List) Value

func (edifList *List) Value() any

type ListElement

type ListElement interface {
	// Value Gets the value of the datatype (string, keyword, integer, e.t.c).
	Value() any
	// DataType Gets the datatype code (ListIdentifierType, KeywordType, e.t.c).
	DataType() ElementType
}

ListElement Represents ANY datatype present in the EDIF file.

type String

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

func CreateString

func CreateString(value string) *String

func (*String) DataType

func (edifString *String) DataType() ElementType

func (*String) Value

func (edifString *String) Value() any

Jump to

Keyboard shortcuts

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