Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mbe-tools
TTool
Commits
d6366e9e
Commit
d6366e9e
authored
6 years ago
by
Siyuan Niu
Browse files
Options
Downloads
Patches
Plain Diff
task division ok html no
parent
0a19b9f2
No related branches found
No related tags found
1 merge request
!128
Simulation siyuan2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
simulators/c++2/src_simulator/arch/MultiCoreCPU.cpp
+15
-9
15 additions, 9 deletions
simulators/c++2/src_simulator/arch/MultiCoreCPU.cpp
simulators/c++2/src_simulator/arch/MultiCoreCPU.h
+2
-1
2 additions, 1 deletion
simulators/c++2/src_simulator/arch/MultiCoreCPU.h
with
17 additions
and
10 deletions
simulators/c++2/src_simulator/arch/MultiCoreCPU.cpp
+
15
−
9
View file @
d6366e9e
...
...
@@ -60,7 +60,7 @@ MultiCoreCPU::MultiCoreCPU(ID iID,
unsigned
int
iChangeIdleModeCycles
,
unsigned
int
iCyclesBeforeIdle
,
unsigned
int
ibyteDataSize
,
unsigned
int
iAmountOfCore
)
:
CPU
(
iID
,
iName
,
iScheduler
,
iAmountOfCore
),
/*_lastTransaction(0),*/
_masterNextTransaction
(
0
),
_timePerCycle
(
iTimePerCycle
)
unsigned
int
iAmountOfCore
)
:
CPU
(
iID
,
iName
,
iScheduler
,
iAmountOfCore
),
/*_lastTransaction(0),*/
_masterNextTransaction
(
0
),
_timePerCycle
(
iTimePerCycle
)
,
coreNumber
(
0
)
#ifdef PENALTIES_ENABLED
,
_pipelineSize
(
iPipelineSize
),
_taskSwitchingCycles
(
iTaskSwitchingCycles
),
_brachingMissrate
(
iBranchingMissrate
)
,
_changeIdleModeCycles
(
iChangeIdleModeCycles
),
_cyclesBeforeIdle
(
iCyclesBeforeIdle
)
...
...
@@ -95,7 +95,7 @@ void MultiCoreCPU::initCore(){
multiCore
[
i
]
=
0
;
}
unsigned
int
MultiCoreCPU
::
getCoreNumber
(){
/*
unsigned int MultiCoreCPU::getCoreNumber(){
unsigned int i;
for( i = 0; i < amountOfCore; i++){
if(multiCore[i] == 0){
...
...
@@ -104,13 +104,15 @@ unsigned int MultiCoreCPU::getCoreNumber(){
}
}
return i;
}
}
*/
TMLTime
MultiCoreCPU
::
getMinEndSchedule
(){
TMLTime
minTime
=
multiCore
[
0
];
for
(
TMLTime
i
=
1
;
i
<
multiCore
.
size
();
i
++
){
if
(
minTime
>
multiCore
[
i
])
if
(
minTime
>
multiCore
[
i
])
{
minTime
=
multiCore
[
i
];
coreNumber
=
i
;
}
}
return
minTime
;
}
...
...
@@ -327,16 +329,20 @@ bool MultiCoreCPU::addTransaction(TMLTransaction* iTransToBeAdded){
std
::
cout
<<
"CPU:addt: to be started"
<<
std
::
endl
;
_endSchedule
=
_nextTransaction
->
getEndTime
();
////test///
unsigned
int
iCoreNumber
=
getCoreNumber
();
multiCore
[
iCoreNumber
]
=
_endSchedule
;
if
(
iCoreNumber
!=
(
amountOfCore
-
1
)){
// unsigned int iCoreNumber=getCoreNumber();
unsigned
static
time
=
0
;
multiCore
[
coreNumber
]
=
_endSchedule
;
if
(
time
<
amountOfCore
-
1
){
_endSchedule
=
0
;
_nextTransaction
->
setTransactCoreNumber
(
coreNumber
);
++
coreNumber
;
}
else
{
_endSchedule
=
getMinEndSchedule
();
initCore
();
_nextTransaction
->
setTransactCoreNumber
(
coreNumber
);
//initCore();
}
_nextTransaction
->
setTransactCoreNumber
(
iCoreNumber
)
;
time
++
;
std
::
cout
<<
"test transaction core number !!!! "
<<
_nextTransaction
->
getTransactCoreNumber
()
<<
std
::
endl
;
std
::
cout
<<
"set end schedule CPU: "
<<
_endSchedule
<<
"
\n
"
;
_simulatedTime
=
max
(
_simulatedTime
,
_endSchedule
);
...
...
This diff is collapsed.
Click to expand it.
simulators/c++2/src_simulator/arch/MultiCoreCPU.h
+
2
−
1
View file @
d6366e9e
...
...
@@ -146,9 +146,10 @@ protected:
///1/Processor frequency
TMLTime
_timePerCycle
;
///test////
unsigned
int
coreNumber
;
//first parameter is the core number
///second parameter is the end schedule in the core
std
::
map
<
unsigned
int
,
int
>
multiCore
;
std
::
map
<
unsigned
int
,
unsigned
int
>
multiCore
;
///initialization of all cores
void
initCore
();
///get the avaliable core
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment