+ Post New Thread
Results 1 to 4 of 4
  1. #1
    Member level 3
    Points: 322, Level: 3

    Join Date
    Jul 2019
    Posts
    66
    Helped
    0 / 0
    Points
    322
    Level
    3

    parameterized MUX implementation

    Hello

    I want to implement a fully parameterized multiplexer. The minimum inputs that it has is 2. Both of them are 16 bit.
    What needs to be configurable is the additional number of inputs that can come to the MUX and also, these are all of different widths. I get that the output width of the MUX will be fixed but these input widths need to be variable and also the number of these inputs need to be variable.
    Is there any SystemVerilog implementation to realize this logic?

    Thanks in advance.

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 31,612, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,312
    Helped
    1719 / 1719
    Points
    31,612
    Level
    43

    Re: parameterized MUX implementation

    Quote Originally Posted by rrucha View Post
    Hello

    I want to implement a fully parameterized multiplexer. The minimum inputs that it has is 2. Both of them are 16 bit. What needs to be configurable is the additional number of inputs that can come to the MUX
    This is possible using a packed array for the inputs and a parameter to define the number of input ports. Synthesis will work with such an array (at least Vivado synthesis and the newer version of Synplify do).

    Quote Originally Posted by rrucha View Post
    and also, these are all of different widths. I get that the output width of the MUX will be fixed but these input widths need to be variable and also the number of these inputs need to be variable.
    Is there any SystemVerilog implementation to realize this logic?
    Thanks in advance.
    The requirement for different widths is not possible in any HDL language. HDLs are not some sort of dynamically typed language. Your requirement would need a language that can have an array that is non-

    Like I've told you before you use the maximum width input and all inputs are that wide. You will need another parameter (an array) that defines the actual width of each input, which you can then use to slice the bit vectors.



    •   AltAdvertisement

        
       

  3. #3
    Member level 3
    Points: 322, Level: 3

    Join Date
    Jul 2019
    Posts
    66
    Helped
    0 / 0
    Points
    322
    Level
    3

    Re: parameterized MUX implementation

    I understand. I figured out the way to do that.
    Can I use the same way to create a parameterized DEMUX as well?



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 31,612, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,312
    Helped
    1719 / 1719
    Points
    31,612
    Level
    43

    Re: parameterized MUX implementation

    Same way as a mux, if you implemented it with max width buses and index the packed array output to select where the input is routed.


    1 members found this post helpful.

--[[ ]]--