Skip to content

Commit

Permalink
fix changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mengyang He committed Jun 16, 2024
1 parent 50ff1ec commit ee4cdcc
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
7 changes: 6 additions & 1 deletion mem/vm/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ func (r *TranslationReq) Clone() sim.Msg {

// GenerateRsp generates response to originral translation request
func (r *TranslationReq) GenerateRsp(page Page) sim.Rsp {
rsp := TranslationRspBuilder{}.WithSrc(r.Dst).WithDst(r.Src).WithRspTo(r.ID).WithPage(page).Build()
rsp := TranslationRspBuilder{}.
WithSrc(r.Dst).
WithDst(r.Src).
WithRspTo(r.ID).
WithPage(page).
Build()

return rsp
}
Expand Down
4 changes: 3 additions & 1 deletion noc/standalone/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ func (m *TrafficMsg) Meta() *sim.MsgMeta {

// Clone returns cloned TrafficMsg
func (m *TrafficMsg) Clone() sim.Msg {
return m
clone_msg := NewTrafficMsg(m.Src, m.Dst, m.TrafficBytes)

Check failure on line 23 in noc/standalone/agent.go

View workflow job for this annotation

GitHub Actions / Akita Compilation

ST1003: should not use underscores in Go names; var clone_msg should be cloneMsg (stylecheck)

Check failure on line 23 in noc/standalone/agent.go

View workflow job for this annotation

GitHub Actions / Akita Compilation

ST1003: should not use underscores in Go names; var clone_msg should be cloneMsg (stylecheck)

return clone_msg
}

// NewTrafficMsg creates a new traffic message
Expand Down
4 changes: 2 additions & 2 deletions sim/examples/ping/comp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ping
import (
"fmt"
"reflect"
"strconv"

"github.com/sarchlab/akita/v4/sim"
"github.com/sarchlab/akita/v4/sim/directconnection"
Expand All @@ -25,6 +24,7 @@ func (p *PingMsg) Clone() sim.Msg {

func (p *PingMsg) GenerateRsp() sim.Rsp {
rsp := &PingRsp{}
rsp.ID = sim.GetIDGenerator().Generate()

return rsp
}
Expand All @@ -44,7 +44,7 @@ func (p *PingRsp) Clone() sim.Msg {
}

func (p *PingRsp) GetRspTo() string {
return strconv.Itoa(p.SeqID)
return p.ID
}

type StartPingEvent struct {
Expand Down
4 changes: 2 additions & 2 deletions sim/examples/ticking_ping/comp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ticking_ping

import (
"fmt"
"strconv"

"github.com/sarchlab/akita/v4/sim"
"github.com/sarchlab/akita/v4/sim/directconnection"
Expand All @@ -27,6 +26,7 @@ func (p *PingMsg) Clone() sim.Msg {

func (p *PingRsp) GenerateRsp() sim.Rsp {
rsp := &PingRsp{}
rsp.ID = sim.GetIDGenerator().Generate()

return rsp
}
Expand All @@ -49,7 +49,7 @@ func (p *PingRsp) Clone() sim.Msg {
}

func (p *PingRsp) GetRspTo() string {
return strconv.Itoa(p.SeqID)
return p.ID
}

type pingTransaction struct {
Expand Down
5 changes: 5 additions & 0 deletions sim/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ type Rsp interface {
GetRspTo() string
}

type Request interface {
Msg
GenerateRsp() Rsp
}

// GeneralRsp is a general response message that is used to indicate the
// completion of a request.
type GeneralRsp struct {
Expand Down
5 changes: 4 additions & 1 deletion sim/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ func (m *sampleMsg) Meta() *MsgMeta {
}

func (m *sampleMsg) Clone() Msg {
return m
cloneMsg := *m
cloneMsg.ID = GetIDGenerator().Generate()

return &cloneMsg
}

// Name returns the name of the port.
Expand Down

0 comments on commit ee4cdcc

Please sign in to comment.