+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Member level 2
    Points: 387, Level: 4

    Join Date
    Feb 2019
    Posts
    46
    Helped
    0 / 0
    Points
    387
    Level
    4

    Error: Subprogram <mmcm_count_calc> does not have a body when creating vhdl package.

    Greetings ... comment that I am new creating vhdl packages and a couple of days ago I am trying to create one, but I am having the following error shown in the image.

    Click image for larger version. 

Name:	error_package.PNG 
Views:	6 
Size:	8.2 KB 
ID:	156119

    Can someone please help me with this error? I leave the code I am using.

    Code:
    LIBRARY ieee;
      USE ieee.std_logic_1164.all;
      USE ieee.std_logic_unsigned.all;
      USE ieee.std_logic_misc.all;
      USE ieee.numeric_std.all;
    
    package g1_mmcme2_drp_func_vhdl is
    
      function mmcm_count_calc (divide : std_logic_vector(7 downto 0) ; phase: std_logic_vector(31 downto 0) ; duty_cycle : integer) return std_logic_vector(37 downto 0);
                
    end package  g1_mmcme2_drp_func_vhdl;
    
    package body g1_mmcme2_drp_func_vhdl is
    function mmcm_count_calc (
      divide     : in std_logic_vector(7 downto 0); -- Max divide is 128
      phase      : in std_logic_vector(31 downto 0);
      duty_cycle : integer)                         -- Multiplied by 100,000
      return std_logic_vector is 
    
      variable div_calc        : std_logic_vector(13 downto 0);
      variable phase_calc      : std_logic_vector(16 downto 0);
      begin
      
      div_calc   := mmcm_divider(divide, std_logic_vector(to_unsigned(duty_cycle,32)));
      -- mx[10:9], pm[8:6], dt[5:0]
      phase_calc(10 downto 0) := mmcm_phase(divide, phase);
    
      -- Return value is the upper and lower address of counter
      --    Upper address is:
      --       RESERVED    [31:26]
      --       MX          [25:24]
      --       EDGE        [23]
      --       NOCOUNT     [22]
      --       DELAY_TIME  [21:16]
      --    Lower Address is:
      --       PHASE_MUX   [15:13]
      --       RESERVED    [12]
      --       HIGH_TIME   [11:6]
      --       LOW_TIME    [5:0]
    
      return
            -- Upper Address
            "000000000000" & phase_calc(10 downto 9) & div_calc(13 downto 12) & phase_calc(5 downto 0) &
            -- Lower Address
            phase_calc(8 downto 6) & '0' & div_calc(11 downto 0);
     end function;
    end g1_mmcme2_drp_func_vhdl;

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 31,824, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,366
    Helped
    1726 / 1726
    Points
    31,824
    Level
    43

    Re: Error: Subprogram <mmcm_count_calc> does not have a body when creating vhdl packa

    The declaration of the function's return type is just the type it doesn't include a range, i.e. "indexed" name is not a type



    •   AltAdvertisement

        
       

  3. #3
    Member level 2
    Points: 387, Level: 4

    Join Date
    Feb 2019
    Posts
    46
    Helped
    0 / 0
    Points
    387
    Level
    4

    Re: Error: Subprogram <mmcm_count_calc> does not have a body when creating vhdl packa

    Thanks for answering ads-ee ... I'm not sure what you mean by "indexed" name is not a type.
    I have made some changes based on the data sheets https://www.xilinx.com/support/docum...-synthesis.pdf on page 207, but I'm still getting the same error. These are the changes in my code.

    Code:
    LIBRARY ieee;
      USE ieee.std_logic_1164.all;
      USE ieee.std_logic_unsigned.all;
      USE ieee.std_logic_misc.all;
      USE ieee.numeric_std.all;
    
    package g1_mmcme2_drp_func_vhdl is
    
      type type_mmcm_count_calc is  
        record
          divide          : std_logic_vector(7 downto 0);  
          phase           : std_logic_vector(31 downto 0);  
          duty_cycle      : integer;   
      end record;
    
      function mmcm_count_calc (arguments: type_mmcm_count_calc) return std_logic_vector(37 downto 0);
                
    end package  g1_mmcme2_drp_func_vhdl;
    
    package body g1_mmcme2_drp_func_vhdl is
    
    function mmcm_count_calc (
      arguments     : type_mmcm_count_calc)                         
      return std_logic_vector is 
      
      variable mmcm_count_calc : std_logic_vector(37 downto 0);
      variable div_calc        : std_logic_vector(13 downto 0);
      variable phase_calc      : std_logic_vector(16 downto 0);
      begin
      
      div_calc   := mmcm_divider(arguments.divide, std_logic_vector(to_unsigned(arguments.duty_cycle,32)));
      -- mx[10:9], pm[8:6], dt[5:0]
      phase_calc(10 downto 0) := mmcm_phase(arguments.divide, arguments.phase);
    
      -- Return value is the upper and lower address of counter
      --    Upper address is:
      --       RESERVED    [31:26]
      --       MX          [25:24]
      --       EDGE        [23]
      --       NOCOUNT     [22]
      --       DELAY_TIME  [21:16]
      --    Lower Address is:
      --       PHASE_MUX   [15:13]
      --       RESERVED    [12]
      --       HIGH_TIME   [11:6]
      --       LOW_TIME    [5:0]
      mmcm_count_calc := "000000000000" & phase_calc(10 downto 9) & div_calc(13 downto 12) & phase_calc(5 downto 0) &
              -- Lower Address
              phase_calc(8 downto 6) & '0' & div_calc(11 downto 0);
      return
      mmcm_count_calc;
            -- Upper Address
            
    end function;
    end g1_mmcme2_drp_func_vhdl;



    •   AltAdvertisement

        
       

  4. #4
    Member level 2
    Points: 387, Level: 4

    Join Date
    Feb 2019
    Posts
    46
    Helped
    0 / 0
    Points
    387
    Level
    4

    Re: Error: Subprogram <mmcm_count_calc> does not have a body when creating vhdl packa

    I just fixed it, I wasn't getting it very much. This is my new code.
    Code:
    BIBLIOTECA ieee;
      USE ieee.std_logic_1164.all;
      USE ieee.std_logic_unsigned.all;
      USE ieee.std_logic_misc.all;
      USE ieee.numeric_std.all;
    
    el paquete g1_mmcme2_drp_func_vhdl es
    
      función mmcm_count_calc (divide: std_logic_vector (7 downto 0); fase: std_logic_vector (31 downto 0); duty_cycle: integer) return std_logic_vector;
                
    paquete final g1_mmcme2_drp_func_vhdl;
    
    el cuerpo del paquete g1_mmcme2_drp_func_vhdl es
    función mmcm_count_calc (
      dividir: en std_logic_vector (7 downto 0); - La división máxima es 128
      fase: en std_logic_vector (31 downto 0);
      duty_cycle: integer) - Multiplicado por 100,000
      return std_logic_vector es 
    
      variable div_calc: std_logic_vector (13 downto 0);
      variable phase_calc: std_logic_vector (16 downto 0);
      empezar
      
      div_calc: = mmcm_divider (divide, std_logic_vector (to_unsigned (duty_cycle, 32)));
      - mx [10: 9], pm [8: 6], dt [5: 0]
      phase_calc (10 downto 0): = mmcm_phase (división, fase);
    
      - El valor de retorno es la dirección superior e inferior del contador
      - La dirección superior es:
      - RESERVADO [31:26]
      - MX [25:24]
      - BORDE [23]
      - CUENTA [22]
      - DELAY_TIME [21:16]
      - Dirección inferior es:
      - PHASE_MUX [15:13]
      - RESERVADO [12]
      - HIGH_TIME [11: 6]
      - LOW_TIME [5: 0]
    
      regreso
            - Dirección superior
            "000000000000" y phase_calc (10 downto 9) y div_calc (13 downto 12) y phase_calc (5 downto 0) &
            - Dirección inferior
            phase_calc (8 downto 6) & '0' & div_calc (11 downto 0);
     función final;
    end g1_mmcme2_drp_func_vhdl;



  5. #5
    Super Moderator
    Points: 31,824, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,366
    Helped
    1726 / 1726
    Points
    31,824
    Level
    43

    Re: Error: Subprogram <mmcm_count_calc> does not have a body when creating vhdl packa

    Quote Originally Posted by Cesar0182 View Post
    Thanks for answering ads-ee ... I'm not sure what you mean by "indexed" name is not a type.
    That was from the error message in your first post.

    The error is due to the line in post #3.
    Code:
    function mmcm_count_calc (arguments: type_mmcm_count_calc) return std_logic_vector(37 downto 0);
    which you finally changed to this in post #4.
    Code:
    función mmcm_count_calc (divide: std_logic_vector (7 downto 0); fase: std_logic_vector (31 downto 0); duty_cycle: integer) return std_logic_vector;
    where you finally removed the index "(37 downto 0)" from the type "std_logic_vector".



--[[ ]]--