Skip to content

Commit

Permalink
misc: fix pre-commit warnings
Browse files Browse the repository at this point in the history
Change-Id: Iaab990ad265f327d0df397b1bd7bd2f3e40f4a79
  • Loading branch information
ckf104 committed Jan 8, 2024
1 parent e62b86d commit 423cfcc
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 215 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ ext/custom/model_counter/libVerilatorCounter.so
ext/custom/libVerilatorCounter.so
ext/custom/custom_packet_counter.hh
ext/custom/wrapper_counter.hh
trace.vcd
trace.vcd
49 changes: 18 additions & 31 deletions README_Zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ else if (decoded_inst->isFloating())
>
> ### commit
>
>
>
>
> pop LSQ阶段:
>
> ~~~c++
> if (completed_inst && (inst->isMemRef() || inst->isFloating() ))
> ~~~
>
>
>
>
>
>
### 添加函数
Expand Down Expand Up @@ -101,7 +101,7 @@ MinorCPU
cpu_, *this,
),
~~~
execute的include
Expand Down Expand Up @@ -160,7 +160,7 @@ execute的include
>
> ~~~c++
> custominst_port = RequestPort("CustomInst Port")
>
>
> _cached_ports = ["icache_port", "dcache_port", "custominst_port"]
> ~~~
>
Expand All @@ -169,9 +169,9 @@ execute的include
> ~~~c++
> else if (if_name == "custominst_port")
> return getCustPort();
>
>
>
>
>
>
> getCustPort().takeOverFrom(&oldCPU->getCustPort());
> ~~~
>
Expand All @@ -180,15 +180,15 @@ execute的include
> ~~~c++
> /** Custom*/
> virtual Port &getCustPort() = 0;
>
>
>
>
>
>
>
>
> ~~~
>
>
>
>
>
>
Expand Down Expand Up @@ -347,21 +347,21 @@ scons build/RISCV/gem5.opt
## 运行gem5
~~~c++
build/RISCV/gem5.opt configs/custom/riscv-floating.py
build/RISCV/gem5.opt configs/custom/riscv-floating.py
~~~
打开debug
~~~bash
build/RISCV/gem5.opt --debug-flags=CustomObj configs/custom/riscv-floating.py
build/RISCV/gem5.opt --debug-flags=CustomObj configs/custom/riscv-floating.py
~~~
运行counter
~~~bash
build/RISCV/gem5.opt --debug-flags=CustomObj configs/custom/riscv-floating-counter.py
build/RISCV/gem5.opt --debug-flags=CustomObj configs/custom/riscv-floating-counter.py
~~~
Expand All @@ -387,7 +387,7 @@ ext/custom/SConscript里面库路径还用的绝对路径,还待解决
报错
~~~bash
root@CsxDesktop:/home/csx/workland/mycode/gem5-custom# build/RISCV/gem5.opt --debug-flags=CustomObj configs/custom/riscv-floating-counter.py
root@CsxDesktop:/home/csx/workland/mycode/gem5-custom# build/RISCV/gem5.opt --debug-flags=CustomObj configs/custom/riscv-floating-counter.py
build/RISCV/gem5.opt: error while loading shared libraries: libVerilatorCounter.so: cannot open shared object file: No such file or directory
~~~
Expand All @@ -396,16 +396,3 @@ build/RISCV/gem5.opt: error while loading shared libraries: libVerilatorCounter.
~~~bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/csx/workland/mycode/gem5_custom/ext/custom
~~~
4 changes: 2 additions & 2 deletions configs/custom/riscv-floating-counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

system.system_port = system.membus.cpu_side_ports

#system.custom.custominst_port = system.membus.cpu_side_ports
# system.custom.custominst_port = system.membus.cpu_side_ports

system.cpu.custominst_port = system.counter.counter_port

Expand All @@ -75,7 +75,7 @@
thispath,
"../../",
"custom_test/float"
#"tests/test-progs/hello/bin/riscv/linux/hello",
# "tests/test-progs/hello/bin/riscv/linux/hello",
)

system.workload = SEWorkload.init_compatible(binary)
Expand Down
4 changes: 2 additions & 2 deletions configs/custom/riscv-floating.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

system.system_port = system.membus.cpu_side_ports

#system.custom.custominst_port = system.membus.cpu_side_ports
# system.custom.custominst_port = system.membus.cpu_side_ports

system.cpu.custominst_port = system.custom.custominst_port

Expand All @@ -75,7 +75,7 @@
thispath,
"../../",
"custom_test/float"
#"tests/test-progs/hello/bin/riscv/linux/hello",
# "tests/test-progs/hello/bin/riscv/linux/hello",
)

system.workload = SEWorkload.init_compatible(binary)
Expand Down
8 changes: 4 additions & 4 deletions src/cpu/minor/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if not env['CONF']['USE_NULL_ISA']:
'MinorOpClass', 'MinorOpClassSet', 'MinorFUTiming', 'MinorFU',
'MinorFUPool', 'BaseMinorCPU'],
enums=['ThreadPolicy'])



Source('activity.cc')
Expand All @@ -61,10 +61,10 @@ if not env['CONF']['USE_NULL_ISA']:
Source('pipeline.cc')
Source('scoreboard.cc')
Source('stats.cc')

Source('custom.cc')



DebugFlag('MinorCPU', 'Minor CPU-level events')
DebugFlag('MinorExecute', 'Minor Execute stage')
Expand All @@ -74,7 +74,7 @@ if not env['CONF']['USE_NULL_ISA']:
DebugFlag('MinorTrace', 'MinorTrace cycle-by-cycle state trace')
DebugFlag('MinorTiming', 'Extra timing for instructions')



CompoundFlag('Minor', [
'MinorCPU', 'MinorExecute', 'MinorInterrupt', 'MinorMem',
Expand Down
8 changes: 3 additions & 5 deletions src/cpu/minor/custom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Custom::SendToRTL(MinorDynInstPtr inst)
Custom::tryToSend(packet);
}

bool
bool
Custom::tryToSend(PacketPtr pkt)
{
DPRINTF(CustomObj, "customInstPort sendTimingReq:%d\n", curTick());
Expand All @@ -55,15 +55,15 @@ Custom::tryToSend(PacketPtr pkt)
return false;
}

void
void
Custom::recvReqRetry()
{
DPRINTF(CustomObj, "customInstPort recvReqRetry:%d\n", curTick());
tryToSend(packet);
}


Port &
Port &
Custom::getPort(const std::string &if_name, PortID idx)
{
if (if_name == "custominst_port")
Expand All @@ -75,5 +75,3 @@ Custom::getPort(const std::string &if_name, PortID idx)
} //End namespace minor

} //End namespace gem5


8 changes: 4 additions & 4 deletions src/cpu/minor/custom.hh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace gem5
{

namespace minor
{

Expand All @@ -36,7 +36,7 @@ class Custom : public Named
CustomInstPort(std::string name, Custom &custom_, MinorCPU &cpu) :
MinorCPU::MinorCPUPort(name, cpu), custom(custom_)
{ }

protected:
bool recvTimingResp(PacketPtr ptk) override { panic("dont imp recvTimingResp"); }

Expand Down Expand Up @@ -73,7 +73,7 @@ class Custom : public Named
void SendToRTL(MinorDynInstPtr inst);

Port & getPort(const std::string &if_name, PortID idx=InvalidPortID);




Expand All @@ -90,4 +90,4 @@ class Custom : public Named



#endif
#endif
2 changes: 1 addition & 1 deletion src/cpu/minor/execute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ Execute::getCustPort()
}

/* */
void
void
Execute::SendToCustom(MinorDynInstPtr inst)
{
DPRINTF(CustomObj, "SendToCustom[%d]\n", curTick());
Expand Down
6 changes: 3 additions & 3 deletions src/custom/CustomCounter.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

from m5.params import *
from m5.proxy import *
from m5.SimObject import SimObject
from m5.objects.CustomObj import CustomObj


class CustomCounter(CustomObj):
type = 'CustomCounter'
type = "CustomCounter"
cxx_header = "custom/custom_counter.hh"
cxx_class = "gem5::CustomCounter"

counter_port = ResponsePort("CPU side port, receives custom inst")
counter_port = ResponsePort("CPU side port, receives custom inst")
5 changes: 3 additions & 2 deletions src/custom/CustomObj.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from m5.proxy import *
from m5.SimObject import SimObject


class CustomObj(SimObject):
type = 'CustomObj'
type = "CustomObj"
cxx_header = "custom/custom_obj.hh"
cxx_class = "gem5::CustomObj"

custominst_port = ResponsePort("CPU side port, receives custom inst")
custominst_port = ResponsePort("CPU side port, receives custom inst")
1 change: 0 additions & 1 deletion src/custom/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ Source('custom_obj.cc')
Source('custom_counter.cc')

DebugFlag('CustomObj', "Custom Inst")

22 changes: 11 additions & 11 deletions src/custom/custom_counter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CustomCounter::CPUSidePort::getAddrRanges() const
return owner->getAddrRanges();
}

void
void
CustomCounter::CPUSidePort::recvFunctional(PacketPtr pkt)
{
return owner->recvFunctional(pkt);
Expand All @@ -55,7 +55,7 @@ CustomCounter::CPUSidePort::recvTimingReq(PacketPtr pkt)
}
}

void
void
CustomCounter::CPUSidePort::sendPacket(PacketPtr pkt)
{
panic_if(blockedPacket != nullptr, "Should never try to send if blocked!\n");
Expand Down Expand Up @@ -86,16 +86,16 @@ CustomCounter::CPUSidePort::trySendRetry()
}


AddrRangeList
AddrRangeList
CustomCounter::getAddrRanges() const
{

}

void
void
CustomCounter::recvFunctional(PacketPtr pkt)
{

}

//---------------------------//
Expand Down Expand Up @@ -125,7 +125,7 @@ CustomCounter::handleInst()
assert(blocked);
DPRINTF(CustomObj, "handle float inst at %d \n", curTick());
reset();

input.ena = 1;
input.rst = 0;
tick();
Expand All @@ -145,7 +145,7 @@ void
CustomCounter::tick()
{
DPRINTF(CustomObj, "tick at %d \n", curTick());

outputCounter out = wr->tick(input);

DPRINTF(CustomObj, "out.cnt = %d \n", out.cnt);
Expand Down Expand Up @@ -174,7 +174,7 @@ CustomCounter::reset()
wr->reset();
}

void
void
CustomCounter::initRTLModel()
{
//traceOn = true
Expand All @@ -184,7 +184,7 @@ CustomCounter::initRTLModel()
//DPRINTF(CustomObj, "out.cnt = %d \n", curTick());
}

void
void
CustomCounter::endRTLModel()
{
DPRINTF(CustomObj, "endRTLModel at %d \n", curTick());
Expand All @@ -195,4 +195,4 @@ CustomCounter::endRTLModel()



}
}
Loading

0 comments on commit 423cfcc

Please sign in to comment.