- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I'm getting this error all the time... and I don't know how to solve this because i'm still a rookie e this thing. Can anybody help me with that and tell me what i'm doing wrong? ------------------------------ Error 10327: Can't determine definition of operator ""-"" ------------------------------ Code: LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.all; USE IEEE.STD_LOGIC_ARITH.all; USE IEEE.STD_LOGIC_SIGNED.all; ENTITY Rec_dados IS PORT( RXD : IN STD_LOGIC; clock_115KHz : IN STD_LOGIC; data_ready : OUT STD_LOGIC; accx_out : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); accy_out : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); accz_out : OUT STD_LOGIC_VECTOR(15 DOWNTO 0)); END Rec_dados; ARCHITECTURE Behavior OF Rec_dados IS SIGNAL count : STD_LOGIC_VECTOR(6 DOWNTO 0); SIGNAL accx_out_int, accy_out_int, accz_out_int : STD_LOGIC_VECTOR(15 DOWNTO 0); BEGIN PROCESS BEGIN WAIT UNTIL clock_115KHz'EVENT and clock_115KHz = '1'; IF count < 32 THEN count <= count + 1; END IF; IF count > 31 AND count < 48 THEN accx_out_int(47 - count) <= RXD; count <= count + 1; END IF; IF count > 47 AND count < 64 THEN accy_out_int(63 - count) <= RXD; count <= count + 1; END IF; IF count > 63 AND count < 80 THEN accz_out_int(79 - count) <= RXD; count <= count + 1; END IF; IF count > 79 THEN accx_out <= accx_out_int; accy_out <= accy_out_int; accz_out <= accz_out_int; data_ready <= '1'; END IF; END PROCESS; END Behavior; Thanks everybody!Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think you can do arithmetic within a bit selection. Probably something more structured like having a combinatorial signal that gets (47 - count). (Of course count is std_logic_vector and 47 is not, so you'll need to figure that out, probably writing 47 in binary "101111"). Then you'll probably need a for-loop that checks each bit of count and assigns and compares to the value, and if they match assigns RXD to that accx bit.
I've also heard recommended to use numeric_std libraries, which are more of a standard, instead of signed/unsigned/etc.(which are from Synopsys, although pretty much everyone understands them. I just think numeric_std does a better job of conversions operator overloading, although not positive).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The index arithmetic like accx_out_int(47 - count) can work, if count is of the integer type. With the legacy non-IEEE libraries, conv_integer() should be the right type cast.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page