- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What's the best way to achieve the following statement, when the user_address size depends on a generic value?
generic ( addr_length: integer; ) signal addr_enable: std_logic; signal user_address: std_logic_vector((addr_length - 1) downto 0); addr_enable <= '0' when (user_address=(others=>'1')) else '1'; Thanks!Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
best way to read it would be create a constant:
constant ALL_ONES : std_logic_vector((addr_length - 1) downto 0) := (others => '1');
addr_enable <= '0' when (user_address=ALL_ONES) else '1';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
or you could use the AND_REDUCE function of the std_logic_misc array:
addr_enable <= '0' when and_reduce(user_address) = '1' else '1'; or the fact that the specified function is just reduced very simply: addr_enable <= nand_reduce(user_address); or even simpler in VHDL 2008: addr_enable <= nand user_address;- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page