From 4a560e881a52d98662016767755ce2743e27adb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=8Blaraibkhan119?= <​laraibnasir119@gmail.com> Date: Thu, 24 Sep 2020 12:07:12 +0500 Subject: [PATCH] lib updated --- src/main/scala/lib/el2_lib.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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