Hi Brad, I see that you added a mantis request based on your proposal of using a guard expression (http://www.eda.org/svdb/view.php?id=4921) I'd like to add the alternative idea that I shared with you of adding ifeach and ifelseeach keywords. That would require setting up the predicate beforehand. I'd like to see something like this: ifeach(selected[i]) ifelseeach(selected[i]) ifelseeach stops after first match. Ifeach and ifelseeach could get final else as well: ifeach(selected[i]) begin output <= input[i]; end else begin nosel <= 1; end And that can work for ifelseeach as well. each of these could get the unique, unique0, and priority keywords. One would need to prepare the selected array beforehand. Noah From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Noah Kanovsky Sent: Thursday, May 15, 2014 1:18 PM To: 'SV_BC List' Subject: [sv-bc] unique and priority keywords for loops Hi, Is there a way to accomplish unique / priority with a for or while loop? For example: module test( input [3:0] sel_enc, input [3:0] in, output reg out ); always_comb begin out = 0; for(int i = 0; i < 5; i++) begin priority if(sel_enc == i) begin out = in[i]; end end end endmodule Most of my modules are parameterized, and these keywords don't help much when you can't write an explicit if else chain or case statement. Noah -- This message has been scanned for viruses and dangerous content by MailScanner<http://www.mailscanner.info/>, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Fri May 30 16:31:33 2014
This archive was generated by hypermail 2.1.8 : Fri May 30 2014 - 16:31:47 PDT