Nov 19, 2019 #1 S 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, In a package I have the following definition of a unconstrained unsigned array: Code: type array_1d_unsigned is array ( integer range <> ) of unsigned ; In another file I have an input port named 'x' that is of that type: Code: entity some_entity is ( x : array_1d_unsigned ) ; While instantiating the entity, I want x to be assigned with a null array. Code: inst_some_entity : some_entity ( x => -- I want to assign a null array here. ) ; What's the correct syntax for that ?
Hello, In a package I have the following definition of a unconstrained unsigned array: Code: type array_1d_unsigned is array ( integer range <> ) of unsigned ; In another file I have an input port named 'x' that is of that type: Code: entity some_entity is ( x : array_1d_unsigned ) ; While instantiating the entity, I want x to be assigned with a null array. Code: inst_some_entity : some_entity ( x => -- I want to assign a null array here. ) ; What's the correct syntax for that ?
Nov 19, 2019 #2 T TrickyDicky Advanced Member level 7 Joined Jun 7, 2010 Messages 7,110 Helped 2,081 Reputation 4,181 Reaction score 2,047 Trophy points 1,393 Activity points 39,769 You'll need to create a null constant (or signal): Code VHDL - [expand]1 2 3 4 5 constant NULL_ARRAY : array_1d_unsigned(1 to 0)(1 to 0) := (others => ""); .. x => NULL_ARRAY, Because its unconstrained, you cannot do it inline, because OTHERS is not allowed in an unconstrained context
You'll need to create a null constant (or signal): Code VHDL - [expand]1 2 3 4 5 constant NULL_ARRAY : array_1d_unsigned(1 to 0)(1 to 0) := (others => ""); .. x => NULL_ARRAY, Because its unconstrained, you cannot do it inline, because OTHERS is not allowed in an unconstrained context
Nov 19, 2019 #3 S 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 This is what I tried to do. But how will the definition of that constant look? Please show an example.
This is what I tried to do. But how will the definition of that constant look? Please show an example.
Nov 19, 2019 #4 T TrickyDicky Advanced Member level 7 Joined Jun 7, 2010 Messages 7,110 Helped 2,081 Reputation 4,181 Reaction score 2,047 Trophy points 1,393 Activity points 39,769 I dont understand what you mean, I showed you how to define the constant.
Nov 19, 2019 #5 S 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 Sorry. I viewed this on my cellphone first. And what you wrote in the line of code didn't show. Forum admins - please note of this problem. A snapshot of how this looks on my phone is attached.
Sorry. I viewed this on my cellphone first. And what you wrote in the line of code didn't show. Forum admins - please note of this problem. A snapshot of how this looks on my phone is attached.
Nov 19, 2019 #6 ads-ee Super Moderator Staff member Joined Sep 10, 2013 Messages 7,944 Helped 1,822 Reputation 3,654 Reaction score 1,808 Trophy points 1,393 Location USA Activity points 60,207 shaiko said: Sorry. I viewed this on my cellphone first. And what you wrote in the line of code didn't show. Forum admins - please note of this problem. A snapshot of how this looks on my phone is attached.View attachment 156581 Click to expand... You can't use the mobile site if you want to see any attachments. The forum on the mobile site is text based only. Use the full site.
shaiko said: Sorry. I viewed this on my cellphone first. And what you wrote in the line of code didn't show. Forum admins - please note of this problem. A snapshot of how this looks on my phone is attached.View attachment 156581 Click to expand... You can't use the mobile site if you want to see any attachments. The forum on the mobile site is text based only. Use the full site.
Nov 19, 2019 #7 S 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 TrickyDicky, The solution with the constant worked. But what if x was an array of integers ? Code: type array_1d_integer is array ( integer range <> ) of integer ; Can you post an example of a null array instantiation of this type ?
TrickyDicky, The solution with the constant worked. But what if x was an array of integers ? Code: type array_1d_integer is array ( integer range <> ) of integer ; Can you post an example of a null array instantiation of this type ?
Nov 20, 2019 #8 T TrickyDicky Advanced Member level 7 Joined Jun 7, 2010 Messages 7,110 Helped 2,081 Reputation 4,181 Reaction score 2,047 Trophy points 1,393 Activity points 39,769 A NULL array is defined as array with 0 length. ie. one with a range where 'left is higher than 'right in the case of to, and 'left is less that 'right when using downto.
A NULL array is defined as array with 0 length. ie. one with a range where 'left is higher than 'right in the case of to, and 'left is less that 'right when using downto.