nakshathra
Junior Member level 1
- Joined
- Sep 4, 2013
- Messages
- 19
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 134
Hi,
I have a std_logic_vector(16 downto 0) which stores a fixed point number in which, the bits (16 downto 8) store the integer part of the fixed point number and (7 downto 0) store the fractional part of the fixed point number.
Now, I need to square the number to obtain the result in another std_logic_vector(16 downto 0) with the same convention.
e.g.
entity square is
port( a: in std_logic_vector(16 downto 0)
b: out std_logic_vector(16 downto 0));
end square;
if input is 1.45, ie a<= "00000001 01110011"
then the output should be 2.1025, ie b should result it "00000010 00011010"
I know the problem simplifies using sfixed type, but my requirement is in std_logic.
I tried coding, but it din't work out..
I would be pleased if someone helps me out with an idea of solving it.
Thanks in advance!
I have a std_logic_vector(16 downto 0) which stores a fixed point number in which, the bits (16 downto 8) store the integer part of the fixed point number and (7 downto 0) store the fractional part of the fixed point number.
Now, I need to square the number to obtain the result in another std_logic_vector(16 downto 0) with the same convention.
e.g.
entity square is
port( a: in std_logic_vector(16 downto 0)
b: out std_logic_vector(16 downto 0));
end square;
if input is 1.45, ie a<= "00000001 01110011"
then the output should be 2.1025, ie b should result it "00000010 00011010"
I know the problem simplifies using sfixed type, but my requirement is in std_logic.
I tried coding, but it din't work out..
I would be pleased if someone helps me out with an idea of solving it.
Thanks in advance!