L
Loppy
Guest
Hi,
I need translate the C code:
int incrementarmodL(int input,int mod)
{
int salida;
salida = (input+2)%mod;
return salida;
}
To VHDL but I Can´t translate because I don´t understand very well
the REM operation in VHDL.
The VHDL code that I am triying :
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 incmodL 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 incmodL;
architecture comportamiento of incmodL is
signal tmp : std_logic_vector(7 downto 0):="00000000";
begin
process(entrada,modulo,reset)
begin
if reset='1' then
salida <= cero;
else
tmp <= entrada or paso;
salida <= tmp REM modulo ;
end if;
end process;
end comportamiento;
but my compiler tell me that : REM can not have such operands in this
context.
anybody can help me.
Thanks.
I need translate the C code:
int incrementarmodL(int input,int mod)
{
int salida;
salida = (input+2)%mod;
return salida;
}
To VHDL but I Can´t translate because I don´t understand very well
the REM operation in VHDL.
The VHDL code that I am triying :
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 incmodL 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 incmodL;
architecture comportamiento of incmodL is
signal tmp : std_logic_vector(7 downto 0):="00000000";
begin
process(entrada,modulo,reset)
begin
if reset='1' then
salida <= cero;
else
tmp <= entrada or paso;
salida <= tmp REM modulo ;
end if;
end process;
end comportamiento;
but my compiler tell me that : REM can not have such operands in this
context.
anybody can help me.
Thanks.