Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

problem having fixed.pkg in VHDL

Status
Not open for further replies.

nick123

Member level 2
Member level 2
Joined
Aug 16, 2014
Messages
53
Helped
3
Reputation
8
Reaction score
3
Trophy points
8
Visit site
Activity points
334
hello,everyone..i dont know much about this site,i just joined today and the reason for joining is i m having problem in using "fixed.pkg" of VHDL.I am writing a code of radix-4,16-point fft,whole code is ready but i m stucked in one place.

Its two's complement code:


Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all; 
use ieee.numeric_std.all;
 
library ieee_proposed;
use ieee_proposed.math_utility_pkg.all;
use ieee_proposed.fixed_pkg.all;
use ieee_proposed.fixed_float_types.all;
------------------------------------------------
entity twoscompliment is
 
 generic (width:natural:=32);
   port(
        A              : in sfixed (8 downto -7);
        compliment : out sfixed (8 downto -7)
        );
 
end twoscompliment;
----------------------------------------------------
architecture behav of twoscompliment is
 
    signal result1 : sfixed (9 downto -7); 
    signal result2 : sfixed (9 downto -7); 
   
 begin
     result1     <= -(A);
     result2     <= to_sfixed(result1,9,-7);
    
    ----result2:=resize(result1,result2'high,result2'low,fixed_wrap,fixed_truncate); 
   
     
      compliment  <= result2 (9 downto -6) ; ------truncat1ng last 1-bit 
 
end behav;



problem is in the line -result1<= -(A);
result2<= to_sfixed(result1,9,-7);

if i use the comment line----result2:=resize(result1,result2'high,result2'low,fixed_wrap,fixed_truncate);

problem is still there,IS THERE ANYONE WHO CAN HELP ME,
THANK YOU IN ADVANCE.
 
Last edited by a moderator:

You didn't tell what's the problem is.
the problem is with the to_sfixed function i used in line '' result2<= to_sfixed(result1,9,-7); ''Am I using it correctly?
Is this code correct or not? i want two's complement code of fixed type input,
I USED DAVIS BOSHOP'S " Fixed_pkg_c.vhdl "
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top