diff --git a/timing/rob/builder.go b/timing/rob/builder.go index 1e58e372..2a0d5728 100644 --- a/timing/rob/builder.go +++ b/timing/rob/builder.go @@ -11,7 +11,7 @@ type Builder struct { freq sim.Freq numReqPerCycle int bufferSize int - bottomUnit sim.Port + bottomUnit sim.Port } // MakeBuilder creates a builder with default parameters. @@ -56,7 +56,7 @@ func (b Builder) Build(name string) *ReorderBuffer { rb.transactions = list.New() rb.transactions.Init() rb.toBottomReqIDToTransactionTable = make(map[string]*list.Element) - + rb.BottomUnit = b.bottomUnit rb.bufferSize = b.bufferSize rb.numReqPerCycle = b.numReqPerCycle diff --git a/timing/rob/rob.go b/timing/rob/rob.go index 260770e3..dd0a051b 100644 --- a/timing/rob/rob.go +++ b/timing/rob/rob.go @@ -4,11 +4,11 @@ package rob import ( "container/list" "github.com/sarchlab/akita/v3/mem/mem" + // "github.com/sarchlab/akita/v3/mem/cache" "github.com/sarchlab/akita/v3/sim" "github.com/sarchlab/akita/v3/tracing" "fmt" "encoding/csv" - "sync" "os" ) @@ -52,8 +52,6 @@ func (m *MilestoneManager) AddMilestone( blockingLocation string, timestamp sim.VTimeInSec, ) { - m.mutex.Lock() - defer m.mutex.Unlock() milestone := Milestone { ID: fmt.Sprintf("milestone_%d", len(m.milestones)+1), TaskID: taskID, @@ -68,7 +66,6 @@ func (m *MilestoneManager) AddMilestone( type MilestoneManager struct { milestones []Milestone - mutex sync.Mutex } var GlobalMilestoneManager = &MilestoneManager{ @@ -76,16 +73,23 @@ var GlobalMilestoneManager = &MilestoneManager{ } func (m *MilestoneManager) GetMilestones() []Milestone { - m.mutex.Lock() - defer m.mutex.Unlock() - return m.milestones } func (b *ReorderBuffer) getTaskID() string { + if b.transactions.Len() > 0 { + trans := b.transactions.Front().Value.(*transaction) + return tracing.MsgIDAtReceiver(trans.reqFromTop, b) + } return "" } +// func (b *ReorderBuffer) canCacheAcceptRequest() bool { +// if *cache != nil { +// return !*cache.isFull() +// } +// return true +// } // Tick updates the status of the ReorderBuffer. func (b *ReorderBuffer) Tick(now sim.VTimeInSec) (madeProgress bool) { @@ -203,6 +207,17 @@ func (b *ReorderBuffer) topDown(now sim.VTimeInSec) bool { return false } + // if !b.canCacheAcceptRequest() { + // GlobalMilestoneManager.AddMilestone( + // b.getTaskID(), + // "Hardware Occupancy", + // "Cache full", + // "topDown", + // now, + // ) + // return false + // } + item := b.topPort.Peek() if item == nil { return false @@ -400,9 +415,6 @@ func (b *ReorderBuffer) duplicateWriteDoneRsp( } func (m *MilestoneManager) ExportMilestonesToCSV(filename string) error { - m.mutex.Lock() - defer m.mutex.Unlock() - for _, milestone := range m.milestones { fmt.Printf("ID: %s, TaskID: %s, BlockingCategory: %s, BlockingReason: %s, BlockingLocation: %s, Timestamp: %v\n", milestone.ID, milestone.TaskID, milestone.BlockingCategory, milestone.BlockingReason, milestone.BlockingLocation, milestone.Timestamp)