Commit 27b159b9 authored by Javier Serrano's avatar Javier Serrano
Browse files

The integrator is now more precise. Multiplication by Ki happens before division by 8192.


git-svn-id: svn+ssh://svn.cern.ch/reps/acc-fpga/trunk2@717 0a99fbf0-06a5-4c52-8a11-fe70044ee989
parent 8d92b2b8
......@@ -30,7 +30,8 @@ signal kpAux, kiAux: std_logic_vector(15 downto 0);
signal kpSigned, kiSigned: signed(13 downto 0);
signal currentSP, dataInSigned: signed(13 downto 0);
signal error15: signed(14 downto 0);
signal kiError, kpError: signed(27 downto 0);
signal kpError, kiError, kiErrorHigh, kiErrorLow: signed(27 downto 0);
signal kiErrorAux: signed(40 downto 0);
signal kiErrorLong: signed(31 downto 0);
signal integral27: signed(26 downto 0);
signal integral14: signed(13 downto 0);
......@@ -42,12 +43,18 @@ signal propOutAux, intOutAux, dataOutAux14, error14, kiErrorSat: signed(13 downt
signal dataOutAux15: signed(14 downto 0);
signal dataSatAux: signed(19 downto 0);
signal intOutLongAux: signed(18 downto 0);
signal intHigh, intLow: signed(13 downto 0);
begin
KP <= kpAux;
KI <= kiAux;
intHigh <= integral27(26 downto 13);
intLow <= '0' & integral27(12 downto 0);
kiErrorAux <= (kiErrorHigh & "0000000000000") + ("0000000000000" & kiErrorLow);
kiError <= kiErrorAux(40 downto 13);
LongIntOut <= std_logic_vector(integral18);
dataInSigned <= signed(DataIn);
......@@ -121,7 +128,9 @@ end process SetPointProcess;
Integrator: process(Clk40)
begin
if Clk40'event and Clk40='1' then
kiError <= kiSigned * integral14;
kiErrorHigh <= kiSigned * intHigh;
kiErrorLow <= kiSigned * intLow;
-- kiError <= kiSigned * integral14;
kiErrorLong <= kiSigned * integral18;
if ConfigMode='0' and RFONRising='1' then
integrateOn <= '1';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment