From 4f52df46799bf616dcdcbcf10397323f2276ddcc Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 6 Dec 2021 14:01:56 +0000 Subject: [PATCH] use one-hot binary-to-unary in dcache.py --- src/soc/experiment/dcache.py | 29 +++++++++++++++++------------ src/soc/experiment/icache.py | 12 +++++++++--- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/soc/experiment/dcache.py b/src/soc/experiment/dcache.py index 5f4982c4..a93aa92e 100644 --- a/src/soc/experiment/dcache.py +++ b/src/soc/experiment/dcache.py @@ -27,6 +27,7 @@ from enum import Enum, unique from nmigen import (Module, Signal, Elaboratable, Cat, Repl, Array, Const, Record) from nmutil.util import Display +from nmigen.lib.coding import Decoder from copy import deepcopy from random import randint, seed @@ -696,10 +697,10 @@ class DCache(Elaboratable): if TLB_NUM_WAYS == 0: return - # XXX TODO: use a Binary-to-Unary Encoder here - tlb_hit_onehot = Signal(TLB_SET_SIZE) - with m.If(r1.tlb_hit.valid): - comb += tlb_hit_onehot.eq(1<