The quick answer is that the BNF only allows a basic data type to be specified in this spot, and an unpacked array is not a basic data type. I would have liked it to have been even stricter, like only allow simple_types since it makes no sense to declare an anonymous struct as the return type of a function. The original reason for disallowing this goes back to SUPERLOG, which had pointers to functions and there was ambiguity in whether your intent was an array of function pointers or an unpacked array return type This was further complicated because of the existence of packed and unpacked array dimensions. ________________________________ From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of Abhishek Roy Sent: Tuesday, July 05, 2005 12:27 AM To: sv-bc Cc: Antara Ghosh; Saikat Bandyopadhyay Subject: [sv-bc] Function cannot return Unpack Array but can return unpack typedef Hi all, Consider the following scenario :- /*********************************************************************** **************/ module test (input [7:0] in1, output bit [3:0] out1 [1:0]); function bit [3:0] func_arr [1:0] (bit [7:0] arg); //invalid syntax : function cannot return unpack array begin func_arr[1] = arg[7:4]; func_arr[0] = arg[3:0]; end endfunction typedef bit [3:0] bit_arr [1:0]; function bit_arr func_type (bit [7:0] arg); //valid syntax : But bit_arr is still unpack typedef begin func_type[1] = arg[7:4]; func_type[0] = arg[3:0]; end endfunction always@(*) begin out1 = func_arr(in1); //invalid assignment out1 = func_type(in1); //valid assignment end endmodule /*********************************************************************** **************/ Hence, when a function can return object of unpack typedef , then why not unpack array. regards -Abhishek Roy -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Fri Mar 13 07:58:17 2009
This archive was generated by hypermail 2.1.8 : Fri Mar 13 2009 - 07:58:54 PDT