[libre-riscv-dev] UnusedElaboratable when running testbench

Luke Kenneth Casson Leighton lkcl at lkcl.net
Wed Jul 24 22:47:39 BST 2019

On Wed, Jul 24, 2019 at 7:07 PM Tobias Platen
<hacks2019 at platen-software.de> wrote:
> When I run the testbench for TLB.py I get several UnusedElaboratable
> warnings. So where do I use an Elaboratable. I tried to find
> documentation, but I found nothing.

 yehyeh, it's a pain, there being little-to-no documentation: try
#m-labs on irc.freenode.net

basically anything that has an "elaborate" method has to be derived
from "Elaboratable".  you don't need to call __init__ (no need to do
Elaboratable.__init__(self)) - just do:

from nmigen import Elaboratable

class TLB(Elaboratable)

like this:

diff --git a/src/TLB/ariane/tlb.py b/src/TLB/ariane/tlb.py
index 1f1fa86..6a29cf6 100644
--- a/src/TLB/ariane/tlb.py
+++ b/src/TLB/ariane/tlb.py
@@ -25,7 +25,7 @@ Online simulator:
 from math import log2
-from nmigen import Signal, Module, Cat, Const, Array
+from nmigen import Signal, Module, Cat, Const, Array, Elaboratable
 from nmigen.cli import verilog, rtlil
 from nmigen.lib.coding import Encoder

@@ -35,7 +35,7 @@ from TLB.ariane.tlb_content import TLBContent


-class TLB:
+class TLB(Elaboratable):
     def __init__(self, tlb_entries=8, asid_width=8):
         self.tlb_entries = tlb_entries
         self.asid_width = asid_width

More information about the libre-riscv-dev mailing list