I have a task that takes in a queue of structs as ref.
File1 has:
- struct defined
- queue of struct declared and initialized
- task definition
File2(which reads file 1)
- Has a struct and queue declaration (exactly the same as file1)
- calling the task method
//file1
typedef struct {
string field_name;
int addr;
int value;
} s_cdt_info_t;
typedef s_cdt_info_t creg_arr[$];
creg_arr sn_creg_arr;
task get_creg_fields(string sw_type, ref creg_arr sn_creg_arr);
case(sw_type)
"A" : sbn_creg_arr = asn_sbn_cdt_struct_q;
..
default ..;
endcase
endtask : get_creg_fields
//----------------------------------------------------------------------//
//FILE2
typedef struct {
string field_name;
int addr;
int value;
} base_cdt_info_t;
base_cdt_info_t abn_cdt_struct_q[$];
//calling the task
file1.get_creg_fields("A", abn_cdt_struct_q);
Error#1: the formal and actual arguments don’t match
to resolve Error#1, I tried $cast(struct_file1, struct_file2)
but that failed too as some unclear verilog syntax err
Maybe I am wrong on many levels… but need some initial thoughts to begin with…