- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to write a conditional concurrent port map without success. Here it is.
map_gen: for i in 0 to N-1 generate
map_0: entity work.my_tff(arch) port map('1', '1', clk, s_q_out(0), s_en_out(0)) when i=0 else
map_g: entity work.my_tff(arch) port map(s_q_out(i-1), s_en_out(i-1), clk, s_q_out(i), s_en_out(i));
end generate;
What´s is wrong? Regards Jaraqui
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Hi, I am trying to write a conditional concurrent port map without success. Here it is.
map_gen: for i in 0 to N-1 generate
map_0: entity work.my_tff(arch) port map('1', '1', clk, s_q_out(0), s_en_out(0)) when i=0 else
map_g: entity work.my_tff(arch) port map(s_q_out(i-1), s_en_out(i-1), clk, s_q_out(i), s_en_out(i));
end generate;
What´s is wrong? Regards Jaraqui --- Quote End --- why don't you just port map for case 0 directly then generate for case i in 1 to N-1 anyway you can't use if like that. each generate is written with its condition being true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just trying to write compact code... only for curiosity.
Looking at the when/else examples of the books, I allways observed that a just single statement is presented. What happens if someone is interested to write something like the code bellow? Is it possible?
statement_a_1; statement_a_2; ... when signal = a else
statement_b_1; statement_b_2; ... when signal = b else
...
statement_z_1; statement_z_2;
Regards Jaraqui
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you code isnt quite right, because it has too many ; in it. I think you mean something like:
a <= b when x = '1'
else c when y = '1'
else d when z = '1'
else e;
Remember to have the final else, otherwise you generate a latch.
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