Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > error with REM of numeric_std

Reply
Thread Tools

error with REM of numeric_std

 
 
Loppy
Guest
Posts: n/a
 
      05-20-2006
I am triying translate the C code:

int incrementarmodL(int input,int mod)
{
int salida;

salida = (input+2)%mod;
return salida;
}

to vhdl with REM operator

the code that I make is:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
--use IEEE.STD_LOGIC_ARITH.ALL;
--use IEEE.STD_LOGIC_UNSIGNED.ALL;



entity inc2modL is
generic ( constant paso: std_logic_vector(7 downto 0):="00000010";
constant cero: std_logic_vector(7 downto 0):="00000000"
);

port ( entrada : in std_logic_vector(7 downto 0);
modulo : in std_logic_vector(7 downto 0);
reset : in std_logic;
salida : inout std_logic_vector(7 downto 0)
);
end inc2modL;

architecture comportamiento of inc2modL is
signal ent2 : std_logic_vector(7 downto 0);
signal v1: UNSIGNED(7 downto 0);
signal v2: UNSIGNED(7 downto 0);
signal v3: UNSIGNED(7 downto 0);

begin

process(entrada,modulo,reset)

begin

if reset='1' then
salida <= cero;
else
ent2 <= entrada or paso;

v1 <= UNSIGNED(ent2);
v2 <= UNSIGNED(modulo);
v3 <= v1 REM v2;

salida <= std_logic_vector(v3);
end if;

end process;


end comportamiento;

when I synthesize, the reports said:

ERROR:Xst:769 - C:/Almacen/Proyecto/Proyectos/pfc/inc2modl.vhd line 40:
Operator <INVALID OPERATOR> must have constant operands or first
operand must be power of 2


Anybody Can help me. Thanks

 
Reply With Quote
 
 
 
 
KJ
Guest
Posts: n/a
 
      05-20-2006


> ERROR:Xst:769 - C:/Almacen/Proyecto/Proyectos/pfc/inc2modl.vhd line 40:
> Operator <INVALID OPERATOR> must have constant operands or first
> operand must be power of 2
>

I think the error message is pretty clear....'v2' is not constant or a power
of 2 (i.e. 2, 4, 8, 16).

From a VHDL language perspective, 'v2' does not need to be a constant or a
power of 2 but the synthesis tool that is giving you the error requires it
to be constant or power of 2....which, by the way, is typical of a synthesis
tool since dividing or getting the remainder when the divisor is an
arbitrary number results in a huge chunk of logic.

If you need to synthesize and have an arbitrary number than you need to
write some code on your own

KJ


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/ and rem, is it synthesizable if the first operand is a power of 2? sonny VHDL 2 09-28-2007 01:26 PM
Use of rem in VHDL salmanghafoor1 VHDL 0 08-02-2007 01:23 PM
error message on xp pro rem., desktop connctn via router to server MCSE 2 12-08-2004 04:09 AM
[ANN] rem 0.0.7 released. yyuu Ruby 2 11-25-2004 03:47 AM
concatenation problem + difference between mod and rem Mohammed khader VHDL 1 11-01-2004 09:26 AM



Advertisments