Skip to content

Can you simulate a purely combinatorial module in Amaranth #1381

Closed Answered by TarikHamedovic
TarikHamedovic asked this question in Q&A
Discussion options

You must be logged in to vote

Just to update that I fixed the problem and thanks for the guidance. If anyone needs a square root module that works and is implemented entirely in the combinatorial domain here is the code:

from amaranth import *
from amaranth.sim import *
from amaranth.back import verilog

class sqrt_combinatorial(Elaboratable):
    def __init__(self, N=32):
        # Define the module's ports

        # Parameters
        self.N = N

        # Inputs
        self.num = Signal(N)         # Input: number to calculate the square root of

        # Outputs
        self.result = Signal(N // 2) # Output: calculated square root


    def elaborate(self, platform):
        """Elaborate the hardware description…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@whitequark
Comment options

@TarikHamedovic
Comment options

@whitequark
Comment options

@TarikHamedovic
Comment options

Answer selected by TarikHamedovic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants