state

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheLineState

type CacheLineState struct {
	Address uint64
	State   string
	Tag     uint64
}

CacheLineState represents a single cache line.

type CacheState

type CacheState struct {
	Hits       uint64
	Misses     uint64
	Accesses   uint64
	Evictions  uint64
	Writebacks uint64
	// Lines is populated only if DetailLevel >= DetailLevelFull
	Lines []CacheLineState
}

CacheState represents the state of a cache.

type DetailLevel

type DetailLevel int

DetailLevel controls the verbosity of the state export.

const (
	// DetailLevelSummary exports only statistics and metadata (default).
	DetailLevelSummary DetailLevel = iota
	// DetailLevelFull exports all internal details (e.g., Cache Lines, Directory Entries).
	DetailLevelFull
)

type DirectoryEntryState

type DirectoryEntryState struct {
	Address uint64
	State   string
	Sharers []int
	Owner   int // -1 if no owner
}

DirectoryEntryState represents a single directory entry.

type DirectoryState

type DirectoryState struct {
	// Entries is populated only if DetailLevel >= DetailLevelFull
	Entries []DirectoryEntryState
}

DirectoryState represents the state of a directory controller.

type ExportConfig

type ExportConfig struct {
	DetailLevel DetailLevel
}

ExportConfig controls the export

type Exporter

type Exporter[T any] interface {
	ExportState(cfg ExportConfig) T
}

Exporter is the interface that components should implement to support visualization. T is the specific State struct for that component.

type LinkState

type LinkState struct {
	SourceID     int
	TargetID     int
	CurrentCycle int
	Latency      int
	Bandwidth    int
	// Occupancy shows the number of packets in each time slot.
	Occupancy []int
}

LinkState represents the state of a link.

type NetworkState

type NetworkState struct {
	CurrentCycle int
	Nodes        []NodeState
	Links        []LinkState
}

NetworkState is the top-level DTO for the entire network state.

type NodeState

type NodeState struct {
	ID           int
	Type         string // e.g., "WorkerNode", "Router"
	CurrentCycle int
	Inputs       []QueueState
	Outputs      []QueueState
	Caches       []CacheState
	Directories  []DirectoryState
	CustomData   map[string]interface{}
}

NodeState represents the state of a single node.

type PacketState

type PacketState struct {
	// PktID is a unique identifier if avail, or derived hash.
	Src   int
	Dst   int
	Cycle int    // Creation or Injection cycle
	Msg   string // Payload summary
	Type  string // Type of the packet (e.g., "Req", "Resp")
}

PacketState represents a summary of a packet.

type QueueState

type QueueState struct {
	Type      string // "Input" or "Output"
	Length    int
	Capacity  int
	Bandwidth int
	Bitmap    string // "1010..." representation of occupied slots
	// Packets is a list of packet summaries.
	// In Summary mode, this might be empty or partial.
	Packets []PacketState
}

QueueState represents the state of an input or output queue.

Jump to

Keyboard shortcuts

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