![]() |
|
|
|
#1 |
|
library ieee;
use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity Vedic4m is port(a : in unsigned(3 downto 0); b : in unsigned(3 downto 0); prod : out unsigned(7 downto 0)); end Vedic4m; architecture behv of Vedic4m is signal p0 : unsigned(1 downto 0); signal p1, p6 : unsigned(1 downto 0); signal p2, p3, p4, p5 : unsigned(2 downto 0); begin p0 <= a(0) + b(0); p1 <= (a(1) and b(0)) + (a(0) and b(1)) + p0(1); p2 <= (a(2) and b(0)) + (a(1) and b(1)) + (a(0) and b(2)) + p1(1); p3 <= (a(3) and b(0)) + (a(2) and b(1)) + (a(1) and b(2)) + (a(0) and b(3)) + p2(2 downto 1); p4 <= (a(3) and b(1)) + (a(2) and b(2)) + (a(1) and b(3)) + p3(2 downto 1); p5 <= (a(3) and b(2)) + (a(2) and b(3)) + p4(2 downto 1); p6 <= (a(3) and b(3)) + p5(2 downto 1); prod <= p6 & p5 & p4 & p3 & p2 & p1 & p0; end behv; this is my code............ I want to use the + operator to add the Bits ans Words as shown The error says # ERROR: C:/Modeltech_ae/examples/Vedic4(20): No feasible entries for infix op: "+" # ERROR: C:/Modeltech_ae/examples/Vedic4(20): Type error resolving infix expression. # ERROR: C:/Modeltech_ae/examples/Vedic4(21): No feasible entries for infix op: "+" # ERROR: C:/Modeltech_ae/examples/Vedic4(21): Bad expression. Can't I use the + operator this way?? Please help deena102 |
|
|
|
|
|
|
#2 |
|
Member
Join Date: Jan 2009
Posts: 31
|
The problem is that a(0) or p0(1) are of type std_logic, and adding std_logic with something else is not allowed.
You can get around that using these helper functions: Code:
Code:
joris |
|
|
|