--=================================================================================================
-- File Name                           : speed_id_iq_pi.vhd
-- Description                         : This module implements the integration of
--                   		             PI_Controller
--							             pi_scheduler_spi

-- Targeted device                     : Microsemi-SoC
-- Author                              : India Solutions Team
--
-- SVN Revision Information            :
-- SVN $Revision                       :
-- SVN $Date                           :
--
-- COPYRIGHT 2016 BY MICROSEMI
-- THE INFORMATION CONTAINED IN THIS DOCUMENT IS SUBJECT TO LICENSING RESTRICTIONS FROM MICROSEMI
-- CORP. IF YOU ARE NOT IN POSSESSION OF WRITTEN AUTHORIZATION FROM MICROSEMI FOR USE OF THIS
-- FILE, THEN THE FILE SHOULD BE IMMEDIATELY DESTROYED AND NO BACK-UP OF THE FILE SHOULD BE MADE.
--
--=================================================================================================

--=================================================================================================
-- Libraries
--=================================================================================================
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.std_logic_signed.ALL;

--=================================================================================================
-- speed_id_iq_pi entity declaration
--=================================================================================================
ENTITY SPEED_ID_IQ_PI IS
GENERIC(
--Generic list
    
    -- Specifies the number of multicycle path delays introduced
    g_NO_MCYCLE_PATH                   : INTEGER RANGE 0 to 4 := 2
    );
PORT (
-- Port List
    -- System reset
    reset_i                            : IN  STD_LOGIC;
    
    -- System clock
    sys_clk_i                          : IN  STD_LOGIC;

    -- Clears all internal buffers
    clear_buffer_i                     : IN  STD_LOGIC;
    
    -- Enable signal for speed pi
    speed_en_i                         : IN  STD_LOGIC;
    
    -- Enable signal for id and iq pi
    idq_en_i                           : IN  STD_LOGIC;
    
    -- Start signal for speed pi operation
    speed_pi_start_i                   : IN  STD_LOGIC;
    
    -- Start for id pi operation
    id_pi_start_i                      : IN  STD_LOGIC;
    
    -- Start for iq pi operation
    iq_pi_start_i                      : IN  STD_LOGIC;
    
    -- Speed PI initialization value when it is disabled
    speed_init_i                       : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Id PI initialization value when it is disabled
    id_init_i                          : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Iq PI initialization value when it is disabled
    iq_init_i                          : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Speed PI reference input
    speed_pi_ref_input_i               : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Speed PI actual input
    speed_pi_act_input_i               : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Speed PI proportional gain
    speed_pi_kp_i                      : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Speed PI integral gain
    speed_pi_ki_i                      : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Speed PI output maximum limit
    speed_pi_ymax_i                    : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Speed PI output minimum limit
    speed_pi_ymin_i                    : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Id PI reference input
    id_pi_ref_input_i                  : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Id PI actual input
    id_pi_act_input_i                  : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Id PI proportional gain
    id_pi_kp_i                         : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Id PI integral gain
    id_pi_ki_i                         : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Id and Iq PI output maximum limit
    idq_pi_ymax_i                      : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Id and Iq PI output minimum limit
    idq_pi_ymin_i                      : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Iq PI reference input
    iq_pi_ref_input_i                  : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Iq PI actual input
    iq_pi_act_input_i                  : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Iq PI proportional gain
    iq_pi_kp_i                         : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Iq PI integral gain
    iq_pi_ki_i                         : IN  STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Control output specifies the completion of speed pi operation
    speed_pi_done_o                    : OUT STD_LOGIC;
    
    -- Control output specifies the completion of id pi operation
    id_pi_done_o                       : OUT STD_LOGIC;    
    
    -- Control output specifies the completion of iq pi operation
    iq_pi_done_o                       : OUT STD_LOGIC;
    
    -- Speed PI controller output
    speed_pi_output_o                  : OUT STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Id pi controller output
    id_pi_output_o                     : OUT STD_LOGIC_VECTOR(17 DOWNTO 0);
    
    -- Iq pi controller output
    iq_pi_output_o                     : OUT STD_LOGIC_VECTOR(17 DOWNTO 0)
);
END speed_id_iq_pi;
`protect begin_protected
`protect version=1
`protect author="author-a", author_info="author-a-details"
`protect encrypt_agent="encryptP1735.pl", encrypt_agent_info="Synplify encryption scripts"

`protect key_keyowner="Synplicity", key_keyname="SYNP05_001", key_method="rsa"
`protect encoding=(enctype="base64", line_length=76, bytes=256)
`protect key_block
K0dGSAMWCrt75r2LnHglWDqyev0zQW08a1WCUE0qac20Ws3UgTtgoIm5poP5EBQdKzTFR0p28ahw
MY8GV/Kad54rmlPbfjKrBQksQNWESOKjY8mz4c4ICeCLEZvLTPYvLUYY0zYe8rqofGOwJO0NIwTS
xBqljYaqDWKSygU1kekzo4aoWNNWovhatejYA6PUAXrZa8FZ5pK1valdmszcNwUJJ9z3iNkEyELz
hRTN01Eo1KaPXFv03C29BruqThWqiGAfALYP1+Tf0EfyxflAW3irXjN6rNIiNq7w1rKPRMNO/7YY
HvRCa112W5Cvkp0wYVlRRhKSIZCpM++md13paQ==

`protect key_keyowner="Mentor Graphics Corporation", key_keyname="MGC-VERIF-SIM-RSA-1", key_method="rsa"
`protect encoding=(enctype="base64", line_length=76, bytes=128)
`protect key_block
CBqvHn0M6dj3yg/nQr0H/VqgG+UTic33Zpn1bHHNtIWxMKG9UbltvpcHsCY+i1fnlTdWxpsY0i0n
2QcpIXRw5M+81gojZ6jmD2tNaS6tI7/QVdteC2Y9KU6jol9SB1WI/QY2T+qwzaZGFKyaV7zumhpY
oMQpV08Ypi2Ng4t2gx0=

`protect key_keyowner="Microsemi Corporation", key_keyname="MSC-IP-KEY-RSA", key_method="rsa"
`protect encoding=(enctype="base64", line_length=76, bytes=960)
`protect key_block
Ez4f1a94x5ZHlS9muKY8uZ0s2gfUBE529zMCyiOc++7zDomApLCm4b2i8aJIN5mVG3GBC6bxB1Rg
yv8pzs+7tjkeq1aVAnBz+iWTlN/WSvdkcIoBXyKsJZBtA5+Sj8S0YLph4QlhJhzw5+wXkZzlOfix
UXOtxauadnWGHVlzCukYzzuMa+pwE/80V66e/DMZIeO/WeEcji2dN34fOuEzKFws+yK+NJOaWQCL
7CFVT4d1huflK+rUBlvAyzLasIGlf4WeVdxi+0S4wSaYsBf3NmiEVRxUKSiymDhbTSFHzxsWZSqD
cyhrfUF38SkFfAsMfuA9aLaD4yN0BFvMDSjLhDqv/8kYkBVkHD1zVQc90W2YuMlpDu/QXtzS//qi
J9dUsztUy7jK6EIyiKL8Xyd8b7G5JcMHDiJYWkxjar76PS5mzZZyplkoXFctwACikRCV4hOZsR0q
zOi1bMPJr1Zh04DLesG9lRFXSs+H3erXqmhkqdEabUJY2/qbHIbYYKcMwkfmkFm/ku+8QbWeFUkR
URqXBg0iif2mvgCWFxVmdgSTt+A9+DK0uDtPBPpQS+QeGtHAUnTzItDyCO6KTaBhX5b+i6Gxsvy9
htBukjU40E8pFauyQev+A6PWl1lpg1I6Psv92PDf6e4kEUZTkM6h7+H3NJips/KmDpRjfiNrCyRK
NDUNDuphskDT5aH6PoQ24OA4GqEcjrSUW3A6JhTQwp+SrwQpZUHr1pqFyHOnulDtB5PqnJAxoARF
iTfapNQCJyCP+HXa9sHpAi31H5nvWCtbOKvJa8G0hNJYyU0NVMKKaUBTX+dpmMsnVBuVp0Rp9uVD
OIxAyqUXVQ9/P33EB7/kkC77GUf8WHrzN7TkpKyzSJ8cG1oyrVdY3HAaV5uiJ20YcWH0nafsVKSW
pzH05oPEbhUF1XwXbjwZuDFeAdS16ngsu6ZaZabGsccf3jO6ZvIRSAo/+tmAtBF4JQduw4E5LT9I
aEDu8Oc7YJE7kS5t6ZhhZq6VqkiM7c46RVtGIK5JNxR2eGYvCaVND0V51rozDdexPThwRgVm89EE
TNkB+JkoE+/WW9Du6MA6zbke6VR9jv09bZg/aRGsPWm9M/o2hIw8L5UPSbPpJsOrOyjm8n+bhH09
N8twsrNId0wkwDTye2iEpw9A1879F71A8rcY2oy/nCnifPmxyoqnokcyfup/w6kfIG5HoUqZe6cZ
r5wgXU0IJwPWCEiVXuiZTLlyO8h1+dOTMpJ3j2QCuusJMYleq7QWVKZSrlm6M4k+

`protect data_keyowner="ip-vendor-a", data_keyname="fpga-ip", data_method="aes128-cbc"
`protect encoding=(enctype="base64", line_length=76, bytes=56592)
`protect data_block
[encoded data, 75456 characters]

`protect end_protected

