Functions in different libs

Discussion in 'VHDL' started by Thomas Reinemann, Apr 21, 2004.

  1. 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
    Thomas Reinemann, Apr 21, 2004
    #1
    1. Advertising

  2. Thomas Reinemann wrote:
    > 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
    Eyck Jentzsch, Apr 23, 2004
    #2
    1. Advertising

  3. Eyck Jentzsch wrote:
    >> library pid_vg;
    >> library serelemente;
    >> library ieee;
    >> library sersupport;
    >> use work.optimisation.all;

    > 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
    Thomas Reinemann, Apr 23, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    2
    Views:
    496
    Gordon Beaton
    Apr 7, 2005
  2. Xiangliang Meng
    Replies:
    1
    Views:
    1,581
    Victor Bazarov
    Jun 21, 2004
  3. Christoph
    Replies:
    2
    Views:
    520
    Richard Bos
    Sep 17, 2003
  4. Raman
    Replies:
    5
    Views:
    1,023
    Raman
    May 9, 2008
  5. Greg Hauptmann
    Replies:
    4
    Views:
    190
    Stefano Crocco
    Feb 7, 2009
Loading...

Share This Page