diff --git a/src/main/scala/lib/el2_lib.scala b/src/main/scala/lib/el2_lib.scala index abc77fa3..9c34e627 100644 --- a/src/main/scala/lib/el2_lib.scala +++ b/src/main/scala/lib/el2_lib.scala @@ -189,7 +189,14 @@ trait el2_lib extends param{ case(true,false) => 68*ICACHE_NUM_WAYS case(true,true) => 71*ICACHE_NUM_WAYS } - + def rvmaskandmatch(mask:UInt, data:UInt, masken:Bool):UInt={ + val matchvec = Wire(Vec(data.getWidth,UInt(1.W))) + val masken_or_fullmask = masken & ~mask.andR + matchvec(0) := masken_or_fullmask | (mask(0) === data(0)).asUInt + for(i <- 1 to data.getWidth-1) + matchvec(i) := Mux(mask(i-1,0).andR & masken_or_fullmask,"b1".U,(mask(i) === data(i)).asUInt) + matchvec.asUInt + } val data_mem_size : Int = memory_cal // Move rvecc_encode to a proper trait def rvecc_encode(din:UInt) = { //Done for verification and testing