Functions in different libs

T

Thomas Reinemann

Hello,

the following code generates an compile error in Modelsim. It complains
an "Incompatible types for assignment." error on the marked line,
see ====> <===.

Both the caller and called function have the same type and structure,
but belong to different libraries. Each function generates some Matlab
code. This has to be happen for the whole hierarchy. The call genetates
no error if both function belong to the same lib.
Function "pid_modal_delay" resides in pid_vg.pid_modal_pack.

library pid_vg;
library serelemente;
library ieee;
library sersupport;
use work.optimisation.all;
use std.textio.all;
use serelemente.basics.all;
use sersupport.general_units.all;
use work.basics.all;
use ieee.numeric_std.all;
use ieee.std_logic_1164.all;
use pid_vg.pid_modal_pack.all;

package body current_controller_struct_pack is
function current_controller_struct_delay

return zeile_rec_ret is
file outfile : text open write_mode is "current_controller_struct.m";
variable rtext : zeile_rec_ret := zeile_rec_ret'(null, null);
variable hd : zeile_ptr := zeile_ptr'(null);
variable letzer : zeile_ptr := zeile_ptr'(null);
-- General constants
constant current_set_d : integer := 0;
constant current_measured_d : integer := 0;
--constant index1 : integer := index + 1;

begin
-- initiate sub instances code generation

*==> rtext := pid_modal_delay; <==========================*

-- Generating m function
add_line (rtext, "function [c]= current_controller_struct
....
add_line (rtext, "c=flat_matrix (c);");
hd := rtext.hd;
while hd /= null loop
letzer := hd;
writeline (outfile, hd.zeile);
hd := hd.nxt;
deallocate (letzer);
end loop;
rtext := zeile_rec_ret'(null, null);
return rtext;
end;
end current_controller_struct_pack;


Regards,

Tom
 
E

Eyck Jentzsch

Thomas said:
Hello,

the following code generates an compile error in Modelsim. It complains
an "Incompatible types for assignment." error on the marked line,
see ====> <===.

Both the caller and called function have the same type and structure,
but belong to different libraries. Each function generates some Matlab
code. This has to be happen for the whole hierarchy. The call genetates
no error if both function belong to the same lib.
Function "pid_modal_delay" resides in pid_vg.pid_modal_pack.

library pid_vg;
library serelemente;
library ieee;
library sersupport;
use work.optimisation.all;
use std.textio.all;
use serelemente.basics.all;
use sersupport.general_units.all;
use work.basics.all;
use ieee.numeric_std.all;
use ieee.std_logic_1164.all;
use pid_vg.pid_modal_pack.all;

package body current_controller_struct_pack is
function current_controller_struct_delay

return zeile_rec_ret is
file outfile : text open write_mode is "current_controller_struct.m";
variable rtext : zeile_rec_ret := zeile_rec_ret'(null, null);
variable hd : zeile_ptr := zeile_ptr'(null);
variable letzer : zeile_ptr := zeile_ptr'(null);
-- General constants
constant current_set_d : integer := 0;
constant current_measured_d : integer := 0;
--constant index1 : integer := index + 1;

begin
-- initiate sub instances code generation

*==> rtext := pid_modal_delay; <==========================*

-- Generating m function
add_line (rtext, "function [c]= current_controller_struct
....
add_line (rtext, "c=flat_matrix (c);");
hd := rtext.hd;
while hd /= null loop
letzer := hd;
writeline (outfile, hd.zeile);
hd := hd.nxt;
deallocate (letzer);
end loop;
rtext := zeile_rec_ret'(null, null);
return rtext;
end;
end current_controller_struct_pack;


Regards,

Tom

Does your package pid_vg.pid_modal_pack declares the type zeile_rec_ret
as well as another package?

-Eyck
 
T

Thomas Reinemann

Eyck said:
Does your package pid_vg.pid_modal_pack declares the type zeile_rec_ret
as well as another package?
No, but it points in the right direction. The type zeile_rec_ret is
declared multiple in work.optimisation. I corrected it already.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top