library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; package package_Thong_so is --- Thong so mach luc constant one_div_Lf : signed(12-1 downto 0) := to_signed(200, 12); --Lf = 5e-3 constant one_div_Cf : signed(18-1 downto 0) := to_signed(66667, 18); --Cf = 15e-6 constant Vdc : signed(11-1 downto 0) := to_signed(180, 11); --Vdc_1cell = 180 constant N : signed(5-1 downto 0) := to_signed(1, 5); --constant Ts: signed(22-1 downto 0) := to_signed(21,22); subtype unit is signed(22-1 downto 0); procedure Tinh_toan(Ts : in unit; Ts_div_Cf, Ts_div_Lf, W_Ts, Vdc_Ts_3Lf : out unit); end package; -- tinh toan phan tu ma tran package body packgage_Thong_so is procedure Tinh_toan(Ts : in unit; Ts_div_Cf, Ts_div_Lf, W_Ts, Vdc_Ts_3Lf : out unit) is variable temp_Ts_div_Cf : signed(40-1 downto 0); variable temp_Ts_div_Lf : signed(34-1 downto 0); variable temp_Vdc_Ts_3Lf : signed(61-1 downto 0); begin temp_Ts_div_Cf := Ts * one_div_Cf; Ts_div_Cf := temp_Ts_div_Cf(temp_Ts_div_Cf'high) & temp_Ts_div_Cf(39-1 downto 18); temp_Ts_div_Lf := Ts * one_div_Lf; Ts_div_Lf := temp_Ts_div_Lf(temp_Ts_div_Lf'high) & temp_Ts_div_Lf(33-1 downto 12); w_Ts := to_signed(6588, 22); temp_Vdc_Ts_3Lf := Ts * Vdc * one_div_Cf * to_signed(171, 10); Vdc_Ts_3Lf := temp_Vdc_Ts_3Lf(temp_Vdc_Ts_3Lf'high) & temp_Vdc_Ts_3Lf(60-1 downto 39); end procedure; end; -- try end package body here!!