Create an svex module representing a datatype. This module declares the wire names that exist inside the datatype, contains module instances representing nested datatypes, and arranges aliases among the various pieces of different wires.
(vl-datatype->mods x modalist) → (mv err wire1 modname modalist1)
An example of how this works. Suppose we have the following rather horrible variable declaration:
struct { union { logic [3:0] a; logic [5:4] b [2:0] ; } c; logic [2:4] d; } [3:0] myvar [2:3];
Modulo the choice of names for the generated modules, this will be reflected in svex as the following module declarations and, finally, a wire and instance declaration for the variable itself:
// Modules implementing the data structure: module b_array (); wire [5:0] __self; // size 6 = 3*2 wire [5:4] <2>; wire [5:4] <1>; wire [5:4] <0>; alias <2> = __self[5:4]; alias <2> = __self[3:2]; alias <2> = __self[1:0]; endmodule module c_union (); wire [5:0] __self; // size 6 = max(6,4) wire [3:0] a; wire [5:0] b; b_array b (); alias b = b.__self; alias a = __self[3:0]; alias b = __self[5:0]; endmodule module myvar_struct (); wire [8:0] __self; // size 9 = 6+3 wire [5:0] c; wire [2:4] d; c_union c (); alias c = c.__self; alias c = __self[8:3]; alias d = __self[2:0]; endmodule module myvar_struct_array (); wire [17:0] __self; // size 18 = 9*2 wire [8:0] <2>; wire [8:0] <3>; myvar_struct <2> (); myvar_struct <3> (); alias <2> = <2>.__self; alias <3> = <3>.__self; alias <2> = __self[17:9]; alias <3> = __self[8:0]; endmodule // Declaration/instance/alias for the variable: wire [17:0] myvar; myvar_struct_array myvar (); alias myvar = myvar.__self;