Verilog & System Verilog - port sizing by inheritance

Status
Not open for further replies.

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
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?
 

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.
 
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…