rourabpaul
Member level 3
I want to make a modulus program by VHDL program,
I have made this code
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity modulus is
port (clk : in std_logic;
x: in std_logic_vector(2 downto 0);
y: in std_logic_vector(2 downto 0);
p: out std_logic_vector(5 downto 0));
end modulous;
architecture modulus_arch of modulus is
signal n : std_logic_vector(2 downto 0);
signal s1: std_logic_vector(5 downto 0);
begin
main: process(x,y,n,clk)
begin
if(rising_edge(clk)) then
while s1<=x loop
n<=n+"001";
s1<=n*y;
end loop;
p<=x-y*(n-"001");
n1<=n;
end if;
end process main;
end modulus_arch;
there is no error indeed,
compilation,simulation, synthesize , implementation have been done ,
but when i want to see in test bench wave form following warning has been seen
//WARNING:Simulator:29 - at 10.000 ns(1): Warning: There is an 'U'|'X'|'W'|'Z'|'-'//
and dont show the desired output
here i gave "110" in 'x'.& "011" in y,
i want to calculate 5 mod 3,
so output should be 2,
but i found '6hXX'
I have made this code
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity modulus is
port (clk : in std_logic;
x: in std_logic_vector(2 downto 0);
y: in std_logic_vector(2 downto 0);
p: out std_logic_vector(5 downto 0));
end modulous;
architecture modulus_arch of modulus is
signal n : std_logic_vector(2 downto 0);
signal s1: std_logic_vector(5 downto 0);
begin
main: process(x,y,n,clk)
begin
if(rising_edge(clk)) then
while s1<=x loop
n<=n+"001";
s1<=n*y;
end loop;
p<=x-y*(n-"001");
n1<=n;
end if;
end process main;
end modulus_arch;
there is no error indeed,
compilation,simulation, synthesize , implementation have been done ,
but when i want to see in test bench wave form following warning has been seen
//WARNING:Simulator:29 - at 10.000 ns(1): Warning: There is an 'U'|'X'|'W'|'Z'|'-'//
and dont show the desired output
here i gave "110" in 'x'.& "011" in y,
i want to calculate 5 mod 3,
so output should be 2,
but i found '6hXX'