+ Post New Thread
Results 1 to 2 of 2
  1. #1
    Advanced Member level 5
    Points: 12,859, Level: 27
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    2,586
    Helped
    300 / 300
    Points
    12,859
    Level
    27

    Verilog & System Verilog - port sizing by inheritance

    Hello,

    VHDL supports leaving the size of component ports unconstrained during declaration.
    Unconstrained ports are constrained during elaboration by inheriting the sizes of the signals we connect to them.

    Example:
    Code:
    signal some_signal : std_logic_vector ( 7 downto 0 ) ;
    
    instantiation_of_some_entity : some_entity 
    (
      some_port => some_signal
    ) ;
    
    --some_entity could have been declared as: 
    
    entity some_entity is
    port 
    (
      some_port : std_logic_vector ( 7 downto 0 ) ; some_port is constrained
    ) ;
    end entity some_entity ;
    
    --some_entity could have also been declared as: 
    
    entity some_entity is
    port 
    (
      some_port : std_logic_vector -- some_port is unconstrained
    ) ;
    end entity some_entity ;
    Questions:
    1. Does Verilog support this?
    2. Does System Verilog support this?

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 3
    Points: 6,244, Level: 18
    Achievements:
    Created Blog entry 7 years registered

    Join Date
    Dec 2011
    Location
    Fremont, CA, USA
    Posts
    764
    Helped
    350 / 350
    Points
    6,244
    Level
    18
    Blog Entries
    4

    Re: Verilog & System Verilog - port sizing by inheritance

    Verilog does not support this. SystemVerilog has dynamically sized unpacked arrays, but nothing for packed arrays (vectors).

    What you can do is pass the size of a port as a module parameter, and use that parameter to size the port.
    Dave Rich
    Senior Verification Consultant
    Mentor Graphics Corporation


    1 members found this post helpful.

--[[ ]]--