Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ issues:
- dupl
- gosec

# Testbench main programs: skip strict checks to avoid unnecessary code churn
- path: test/testbench/
linters:
- errcheck
- funlen
- lll

# Exclude known linters from partially hard-vendored code,
# which is impossible to exclude via "nolint" comments.
- path: internal/hmac/
Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ func (d DeviceBuilder) createTiles(
) {
var exit = false
var retVal = uint32(0)
var exitReqTimestamp = float64(0)
for y := 0; y < d.height; y++ {
dev.Tiles[y] = make([]*tile, d.width)
for x := 0; x < d.width; x++ {
Expand All @@ -186,6 +187,7 @@ func (d DeviceBuilder) createTiles(
WithFreq(d.freq).
WithExitAddr(&exit).
WithRetValAddr(&retVal).
WithExitReqAddr(&exitReqTimestamp).
Build(coreName)

if d.monitor != nil {
Expand Down
25 changes: 15 additions & 10 deletions core/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (

// Builder can create new cores.
type Builder struct {
engine sim.Engine
freq sim.Freq
exitAddr *bool
retValAddr *uint32
engine sim.Engine
freq sim.Freq
exitAddr *bool
retValAddr *uint32
exitReqAddr *float64
}

// WithEngine sets the engine.
Expand All @@ -37,6 +38,11 @@ func (b Builder) WithRetValAddr(retValAddr *uint32) Builder {
return b
}

func (b Builder) WithExitReqAddr(exitReqAddr *float64) Builder {
b.exitReqAddr = exitReqAddr
return b
}

// Build creates a core.
//
//nolint:funlen
Expand All @@ -48,10 +54,11 @@ func (b Builder) Build(name string) *Core {
CareFlags: true,
}
c.state = coreState{
exit: b.exitAddr,
retVal: b.retValAddr,
SelectedBlock: nil,
PCInBlock: -1,
exit: b.exitAddr,
retVal: b.retValAddr,
requestExitTimestamp: b.exitReqAddr,
SelectedBlock: nil,
Comment on lines 50 to +60
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build copies b.exitReqAddr into coreState.requestExitTimestamp, but exitReqAddr is optional and can be nil. Since runRet/RunInstructionGroup dereference this pointer, Build should ensure it is always non-nil (e.g., default to an internal float64 when nil) to avoid runtime panics for API consumers.

Copilot uses AI. Check for mistakes.
PCInBlock: -1,
Directions: map[string]bool{
"North": true,
"East": true,
Expand Down Expand Up @@ -87,8 +94,6 @@ func (b Builder) Build(name string) *Core {
c.state.SendBufHeadBusy[i] = make([]bool, 12)
}

c.state.States["Phiconst"] = false

c.ports = make(map[cgra.Side]*portPair)

b.makePort(c, cgra.North)
Expand Down
Loading