soujanya04
Newbie level 4

Hello all,
I am trying to design a digital PID controller using Spartan 3e FPGA and VHDL coding.
I used sfixed data. Initially I assumed input, delayed output and system_output to be sfixed(7 downto -8). After arithmetic operations I got the output c(22 downto -51), which I have to store it back in to system_output(7 downto -8). The main part here is to truncate/round off the resultant output to remove 15 bits from the decimal part.
Using the above command gives a huge error.
Please suggest me a way to approximately represent the (22 downto -51) data into (7 downto -8) length variable.
I am using Xilinx 14.7 version.
I am trying to design a digital PID controller using Spartan 3e FPGA and VHDL coding.
I used sfixed data. Initially I assumed input, delayed output and system_output to be sfixed(7 downto -8). After arithmetic operations I got the output c(22 downto -51), which I have to store it back in to system_output(7 downto -8). The main part here is to truncate/round off the resultant output to remove 15 bits from the decimal part.
Code:
system_output => resize(c,system_output'high, system_output'low, fixed_overflow_style,fixed_round);
Please suggest me a way to approximately represent the (22 downto -51) data into (7 downto -8) length variable.
I am using Xilinx 14.7 version.