val

package
v0.0.0-...-bccf2d6 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitStr

type BitStr string

BitStr (bit string) is used for representing init values. BitStr type is needed for 2 reasons:

  1. To support default value for registers with arbitrary width.
  2. To support meta logic values supported in Hardware Description Languages.

func MakeBitStr

func MakeBitStr(bs val.BitStr) BitStr

func (BitStr) BitWidth

func (bs BitStr) BitWidth() int64

BitWidth returns bit width of the bit string.

func (BitStr) CharWidth

func (bs BitStr) CharWidth() int64

CharWidth returns character width of the bit string excluding format specifier and leading and trailing '"'.

func (BitStr) Extend

func (bs BitStr) Extend(width int64) BitStr

Extend extends BitStr to given width and returns new BitStr. If the provided width is lesser than the current width it panics. Additional bits are added at the beginning and have value '0'. For example, extending b"1" to width 2 returns b"01".

func (BitStr) IsBin

func (bs BitStr) IsBin() bool

func (BitStr) IsHex

func (bs BitStr) IsHex() bool

func (BitStr) IsOctal

func (bs BitStr) IsOctal() bool

func (BitStr) ToBin

func (bs BitStr) ToBin() BitStr

func (BitStr) Uint64

func (bs BitStr) Uint64() uint64

Uint64 converts bit string to uint64. If conversion is not possible, for example because of meta values within the bit string, it panics.

func (BitStr) ValueLiteral

func (bs BitStr) ValueLiteral() string

ValueLiteral returns the internal value pattern of bit string represented as a string. For example, ValueLiteral for x"AB" returns AB, for b"1100" returns 1100.

type MultiRange

type MultiRange []SingleRange

MultiRange represents possible multiple value ranges. For example, [1:3, 8:10] means that the value can equal 1, 2, 3, 8, 9 or 10.

func (MultiRange) IsEmpty

func (ml MultiRange) IsEmpty() bool

TODO: This function can potentially be removed.

func (MultiRange) Width

func (ml MultiRange) Width() int64

Width returns bit width required to represent the range list.

type Range

type Range interface {
	Width() int64
	// contains filtered or unexported methods
}

type SingleRange

type SingleRange struct {
	Left  int64 // Left bound
	Right int64 // Right bound
}

SingleRange represents possible single value range.

func (SingleRange) Width

func (sr SingleRange) Width() int64

Width returns bit width required to represent the range.

type Time

type Time struct {
	S  int64
	Ns int64
}

func (Time) IsZero

func (t Time) IsZero() bool

Jump to

Keyboard shortcuts

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