networkconnector

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package networkconnector defines a connector that is flexible to build any network topologies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BandwidthFirstRouter

type BandwidthFirstRouter struct {
	FlitSize int
}

BandwidthFirstRouter is a simple router that always establish route that involves the least number of hops.

func (BandwidthFirstRouter) EstablishRoute

func (r BandwidthFirstRouter) EstablishRoute(nodes []Node)

EstablishRoute creates routes for the tables.

type Connector

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

Connector can build complex network topologies.

func MakeConnector

func MakeConnector() Connector

MakeConnector creates a network connector

func (*Connector) AddSwitch

func (c *Connector) AddSwitch() (switchID int)

AddSwitch adds a new switch to the network.

func (*Connector) AddSwitchWithName

func (c *Connector) AddSwitchWithName(swName string) (switchID int)

AddSwitchWithName adds a new switch to the network with an externally provided Name.

func (*Connector) AddSwitchWithNameAndRoutingTable

func (c *Connector) AddSwitchWithNameAndRoutingTable(
	swName string,
	rt routing.Table,
) (switchID int)

AddSwitchWithNameAndRoutingTable adds a new switch to the network with an externally provided name and routing table.

func (*Connector) ConnectDevice

func (c *Connector) ConnectDevice(
	switchID int,
	ports []sim.Port,
	param DeviceToSwitchLinkParameter,
)

ConnectDevice connects a few ports that belongs to the device to a switch that is identified by switchID.

func (*Connector) ConnectDeviceWithEPName

func (c *Connector) ConnectDeviceWithEPName(
	epName string,
	switchID int,
	ports []sim.Port,
	param DeviceToSwitchLinkParameter,
) (epPort, swPort sim.Port)

ConnectDeviceWithEPName connects a few ports that belongs to the device to a switch that is identified by switchID.

func (*Connector) ConnectSwitches

func (c *Connector) ConnectSwitches(
	leftSwitchID, rightSwitchID int,
	param SwitchToSwitchLinkParameter,
) (leftPort, rightPort sim.Port)

ConnectSwitches create a connection between two switches. The connection created is bi-directional.

func (*Connector) EstablishRoute

func (c *Connector) EstablishRoute()

EstablishRoute sets the routing table for all the nodes.

func (*Connector) GetFlitSize

func (c *Connector) GetFlitSize() int

GetFlitSize returns the flit size used by the network.

func (*Connector) NewNetwork

func (c *Connector) NewNetwork(name string)

NewNetwork resets the connector, making it ready to create a new network with the give Name.

func (Connector) WithDefaultFreq

func (c Connector) WithDefaultFreq(f sim.Freq) Connector

WithDefaultFreq sets the default frequency used by the components in the connection. Note that channels will not use the default frequency. Channels use their own frequency to adjust bandwidth.

func (Connector) WithEngine

func (c Connector) WithEngine(e sim.Engine) Connector

WithEngine sets the engine to be used by all the components in the connection.

func (Connector) WithFlitSize

func (c Connector) WithFlitSize(size int) Connector

WithFlitSize sets the flit size to be used throughout the network.

func (Connector) WithMonitor

func (c Connector) WithMonitor(m *monitoring.Monitor) Connector

WithMonitor sets the monitor that monitors all the components in the connection.

func (Connector) WithNoCTracer

func (c Connector) WithNoCTracer(t tracing.Tracer) Connector

WithNoCTracer sets the tracer used to trace NoC-specific metrics, such as the traffics and congestions in the channels.

func (Connector) WithPerfAnalyzer

func (c Connector) WithPerfAnalyzer(
	a *analysis.PerfAnalyzer,
) Connector

WithPerfAnalyzer sets the buffer analyzer that can record the buffer levels in the network.

func (Connector) WithRouter

func (c Connector) WithRouter(r Router) Connector

WithRouter sets the router to use to establish the routing tables.

func (Connector) WithVisTracer

func (c Connector) WithVisTracer(t tracing.Tracer) Connector

WithVisTracer sets the tracer used to trace tasks in the network.

type DeviceToSwitchLinkParameter

type DeviceToSwitchLinkParameter struct {
	DeviceEndParam LinkEndDeviceParameter
	SwitchEndParam LinkEndSwitchParameter
	LinkParam      LinkParameter
}

DeviceToSwitchLinkParameter contains the parameters that define a link between a device and a switch.

type FloydWarshallRouter

type FloydWarshallRouter struct{}

FloydWarshallRouter is a simple router that always establish route that involves the least number of hops.

func (FloydWarshallRouter) EstablishRoute

func (r FloydWarshallRouter) EstablishRoute(nodes []Node)

EstablishRoute creates routes for the tables.

type LinkEndDeviceParameter

type LinkEndDeviceParameter struct {
	IncomingBufSize  int
	OutgoingBufSize  int
	NumInputChannel  int
	NumOutputChannel int
}

LinkEndDeviceParameter defines the parameter that associated with an end of a link that is connected to a device.

type LinkEndSwitchParameter

type LinkEndSwitchParameter struct {
	IncomingBufSize  int
	OutgoingBufSize  int
	NumInputChannel  int
	NumOutputChannel int
	Latency          int
	PortName         string
}

LinkEndSwitchParameter defines the parameter that associated with an end of a link that is connected to a switch.

type LinkParameter

type LinkParameter struct {
	IsIdeal       bool
	Frequency     sim.Freq
	NumStage      int
	CyclePerStage int
	PipelineWidth int
}

LinkParameter defines the parameter of the link that connects to nodes.

type Node

type Node interface {
	ListRemotes() []Remote
	Table() routing.Table
	Name() string
}

Node represents an endpoint or a switch.

type Remote

type Remote struct {
	LocalNode Node
	LocalPort sim.Port

	RemoteNode Node
	RemotePort sim.Port

	Link sim.Connection
}

Remote records the link between two nodes.

func (Remote) Bandwidth

func (r Remote) Bandwidth(flitSize int) float64

Bandwidth returns the bandwidth of the link.

type Router

type Router interface {
	EstablishRoute(nodes []Node)
}

Router can help establish the routes of a network.

type SwitchToSwitchLinkParameter

type SwitchToSwitchLinkParameter struct {
	LeftEndParam  LinkEndSwitchParameter
	RightEndParam LinkEndSwitchParameter
	LinkParam     LinkParameter
}

SwitchToSwitchLinkParameter contains the parameters that define a link between two switches.

Jump to

Keyboard shortcuts

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