Fix bug and improve expression by using Int.
This commit is contained in:
@@ -61,7 +61,7 @@ interface Map#(type ky, type ix, type vl, numeric type as);
|
||||
method Bool clearDone;
|
||||
endinterface
|
||||
|
||||
module mkMapLossy(Map#(ky,ix,vl,as)) provisos (
|
||||
module mkMapLossy#(vl default_value)(Map#(ky,ix,vl,as)) provisos (
|
||||
Bits#(ky,ky_sz), Bits#(vl,vl_sz), Eq#(ky), Arith#(ky),
|
||||
Bounded#(ix), Literal#(ix), Bits#(ix, ix_sz),
|
||||
Bitwise#(ix), Eq#(ix), Arith#(ix));
|
||||
@@ -83,18 +83,18 @@ Bitwise#(ix), Eq#(ix), Arith#(ix));
|
||||
action
|
||||
Bool found = False;
|
||||
Bit#(TLog#(as)) way = wayNext;
|
||||
MapKeyValue#(ky,vl) old = unpack(0);
|
||||
vl old_value = default_value;
|
||||
if (a > 1) begin
|
||||
for (Integer i = 0; i < a; i = i + 1) begin
|
||||
MapKeyValue#(ky,vl) entry = mem[i].sub(ki.index);
|
||||
if (entry.key == ki.key) begin
|
||||
found = True;
|
||||
way = fromInteger(i);
|
||||
old = entry;
|
||||
old_value = entry.value;
|
||||
end
|
||||
end
|
||||
end
|
||||
if (found || insert) mem[way].upd(ki.index, MapKeyValue{key: ki.key, value: up(old.value, value)});
|
||||
if (found || insert) mem[way].upd(ki.index, MapKeyValue{key: ki.key, value: up(old_value, value)});
|
||||
wayNext <= (wayNext == fromInteger(a-1)) ? 0: wayNext + 1;
|
||||
didUpdate.send;
|
||||
endaction
|
||||
|
||||
@@ -957,7 +957,7 @@ module mkSplitLSQ(SplitLSQ);
|
||||
RWire#(void) wrongSpec_wakeBySB_conflict <- mkRWire;
|
||||
// make wrongSpec more urgent than firstSt (resolve bsc error)
|
||||
Wire#(Bool) wrongSpec_urgent_firstSt <- mkDWire(True);
|
||||
Map#(Bit#(10),Bit#(6),UInt#(2),2) ldKillMap <- mkMapLossy;
|
||||
Map#(Bit#(10),Bit#(6),Int#(3),2) ldKillMap <- mkMapLossy(minBound);
|
||||
Reg#(Bit#(16)) rand_count <- mkReg(0);
|
||||
rule inc_rand_count;
|
||||
rand_count <= rand_count + 1;
|
||||
@@ -2132,12 +2132,12 @@ module mkSplitLSQ(SplitLSQ);
|
||||
Bool rand_inv = (rand_count & (512-1)) == 0;
|
||||
Bool waited = ld_waitForOlderSt[deqP]; // Don't negative train if we waited for older stores.
|
||||
// Update predictor.
|
||||
UInt#(3) inc = 1; // Subtract one by default.
|
||||
Int#(3) inc = -1; // Subtract one by default.
|
||||
if (waited) inc = 0; // Don't train if we waited for stores.
|
||||
else if (killedLd) inc = 2; // Double train if we flushed the pipe.
|
||||
ldKillMap.updateWithFunc(unpack(ld_pc_hash[deqP]), // Key
|
||||
inc, // value; don't train if we waited.
|
||||
killedLd ? boundedPlus:boundedMinus, // function to combine this value with existing
|
||||
boundedPlus, // function to combine this value with existing
|
||||
killedLd || rand_inv // insert if doesn't exist
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user