1
\$\begingroup\$

I am trying to convert highly parametrized VHDL code to verilog. This VHDL code uses good amount of packages and records and I couldn't find the substitute for those in verilog. Also I am just 3 days old in verilog.

Package and entity files in VHDL are as follows:

package control_package is

type control_ca_out is record
   reset           : std_logic;
   end record;

type control_in is record
  clk             : std_logic;
  ha              : psl_control_in;
  dc              : dma_dc_out;
end record;

type control_out is record
  ca              : control_ca_out;
  ah              : psl_control_out;
  cd              : dma_cd_in;
end record;



entity control is
port (
   i                           : in  control_in;
   o                           : out control_out
);
end entity control;

Package and entity are in separate files. How do i implement the same in verilog? I know there's a way of packing all fields of records in single vector and then use part-select to access different fields of record. How could I include them in separate module in verilog?

\$\endgroup\$
2
  • 2
    \$\begingroup\$ You should seriously consider using SystemVerlog as this would be quite trivial to convert to a struct And SystemVerilog has packages. There is no such construct in Verilog. \$\endgroup\$
    – dave_59
    Commented Dec 4, 2015 at 17:14
  • \$\begingroup\$ I think i would switch to SV. \$\endgroup\$
    – Ishan
    Commented Dec 8, 2015 at 17:01

1 Answer 1

2
\$\begingroup\$

You should seriously consider using SystemVerlog as this would be quite trivial to convert to a struct And SystemVerilog has packages. There is no such construct in Verilog.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.