help="Number of digits of precision after decimal point\
for injection rate")
+parser.add_option("--sim-cycles", type="int", default=1000,
+ help="Number of simulation cycles")
+
parser.add_option("--fixed-pkts", action="store_true",
help="Network_test: send only -p number of packets")
% (options.num_cpus, block_size)
sys.exit(1)
+
cpus = [ NetworkTest(fixed_pkts=options.fixed_pkts, \
max_packets=options.maxpackets, \
+ sim_cycles=options.sim_cycles, \
traffic_type=options.synthetic, \
inj_rate=options.injectionrate, \
precision=options.precision, \
block_offset = Param.Int(6, "block offset in bits")
num_memories = Param.Int(1, "Num Memories")
memory_size = Param.Int(65536, "memory size")
+ sim_cycles = Param.Int(1000, "Number of simulation cycles")
fixed_pkts = Param.Bool(False, "Send fixed number of packets")
max_packets = Param.Counter(0, "Number of packets to send when in fixed_pkts mode")
traffic_type = Param.Counter(0, "Traffic type: uniform random, tornado, bit complement")
void
NetworkTest::sendPkt(PacketPtr pkt)
{
- if (cachePort.sendTiming(pkt)) {
- numPacketsSent++;
- accessRetry = false;
- } else {
- accessRetry = true;
- retryPkt = pkt;
+ if (!cachePort.sendTiming(pkt)) {
+ retryPkt = pkt; // RubyPort will retry sending
}
+ numPacketsSent++;
}
NetworkTest::NetworkTest(const Params *p)
size(p->memory_size),
blockSizeBits(p->block_offset),
numMemories(p->num_memories),
+ simCycles(p->sim_cycles),
fixedPkts(p->fixed_pkts),
maxPackets(p->max_packets),
trafficType(p->traffic_type),
id = TESTER_NETWORK++;
DPRINTF(NetworkTest,"Config Created: Name = %s , and id = %d\n",
name(), id);
-
- accessRetry = false;
}
Port *
void
NetworkTest::tick()
{
- if (!tickEvent.scheduled())
- schedule(tickEvent, curTick() + ticks(1));
-
if (++noResponseCycles >= 500000) {
cerr << name() << ": deadlocked at cycle " << curTick() << endl;
fatal("");
}
- if (accessRetry) {
- sendPkt(retryPkt);
- return;
- }
-
// make new request based on injection rate
// (injection rate's range depends on precision)
// - generate a random number between 0 and 10^precision
generatePkt();
}
}
+
+ // Schedule wakeup
+ if (curTick() >= simCycles)
+ exitSimLoop("Network Tester completed simCycles");
+ else {
+ if (!tickEvent.scheduled())
+ schedule(tickEvent, curTick() + ticks(1));
+ }
}
void
{
unsigned destination = id;
if (trafficType == 0) { // Uniform Random
- while (destination == id)
- destination = random() % numMemories;
+ destination = random() % numMemories;
} else if (trafficType == 1) { // Tornado
int networkDimension = (int) sqrt(numMemories);
int my_x = id%networkDimension;
NetworkTest::doRetry()
{
if (cachePort.sendTiming(retryPkt)) {
- accessRetry = false;
retryPkt = NULL;
}
}