Skip to content

Commit

Permalink
merge PR #85,#88
Browse files Browse the repository at this point in the history
  • Loading branch information
Mengyang He committed Apr 13, 2024
1 parent dbc54d1 commit 3637d22
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion noc/networking/pcie/pcie.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (c *Connector) WithVersion(version int, width int) *Connector {
}

linkBandwidth := linkBandwidthTable[version]
totalBandwidth := linkBandwidth * uint64(width)
totalBandwidth := linkBandwidth * uint64(width) / 8

return c.WithBandwidth(totalBandwidth)
}
Expand Down
3 changes: 3 additions & 0 deletions noc/networking/switching/endpoint/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func MakeBuilder() Builder {
freq: 1 * sim.GHz,
numInputChannels: 1,
numOutputChannels: 1,
encodingOverhead: 0.25,
}
}

Expand Down Expand Up @@ -101,6 +102,8 @@ func (b Builder) Build(name string) *Comp {
ep.assemblingMsgs = list.New()
ep.assemblingMsgTable = make(map[string]*list.Element)

ep.encodingOverhead = b.encodingOverhead

ep.NetworkPort = sim.NewLimitNumMsgPort(
ep, b.networkPortBufferSize,
fmt.Sprintf("%s.NetworkPort", ep.Name()))
Expand Down
13 changes: 11 additions & 2 deletions sim/portowner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sim
import (
"fmt"
"os"
"sort"
)

// A PortOwner is an element that can communicate with others through ports.
Expand Down Expand Up @@ -54,10 +55,18 @@ func (po PortOwnerBase) GetPortByName(name string) Port {

// Ports returns a slices of all the ports owned by the PortOwner.
func (po PortOwnerBase) Ports() []Port {
portList := make([]string, 0, len(po.ports))

for k := range po.ports {
portList = append(portList, k)
}

sort.Strings(portList)

list := make([]Port, 0, len(po.ports))

for _, p := range po.ports {
list = append(list, p)
for _, port := range portList {
list = append(list, po.ports[port])
}

return list
Expand Down

0 comments on commit 3637d22

Please sign in to comment.