[sv-bc] Function cannot return Unpack Array but can return unpack typedef

From: Abhishek Roy <abhishek_at_.....>
Date: Tue Jul 05 2005 - 00:27:20 PDT
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
Received on Tue Jul 5 00:13:03 2005

This archive was generated by hypermail 2.1.8 : Tue Jul 05 2005 - 00:13:21 PDT