H
hongyan
Guest
The following is my source code;
-----------------------------------------------------------
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity EGC is
generic(M : natural := 4);
Port ( input1 : in std_logic_vector(15 downto 0);
output1 : out std_logic_vector(15 downto 0));
end EGC;
architecture Behavioral of EGC is
subtype vector16 is std_logic_vector(15 downto 0);
type vector_M_16_Out is array(0 to M) of vector16;
signal out1: vector_M_16_Out;
begin
out1(0) <= input1;
proc0 : process(out1, input1)
begin
--out1(0) <= input1;
for i in 1 to M loop
out1(i) <= 2+out1(i-1);
end loop;
end process proc0;
output1 <= out1(M);
end Behavioral;
-----------------------------------------------
It is very strange that it doesn't work this way. All the signals
out1(0-4) are xxxx. But if I put "out1(0) <= input1;" into the
process, it works fine.
I can't understand this because the for loop in the process won't
modify the out1(0). Did I miss somthing? Any suggestions will be
appreciate.
For your convience, here is my test file and .do file:
test file
-----------------------------------------------
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
------------------------entity Declaration----------------------------
entity test_EGC is
end test_EGC;
------------------------ Architecture Declaration
----------------------
architecture test_EGC of test_EGC is
signal output1, input1: std_logic_vector(15 downto 0);
component EGC
generic(M : natural := 4);
Port ( input1 : in std_logic_vector(15 downto 0);
output1 : out std_logic_vector(15 downto 0));
end component;
begin
proc_input1 : process is
begin
input1 <= X"0001";
wait for 60 ns;
input1 <= X"0000";
wait;
end process proc_input1; --proc_reset : process is
U_EGC : EGC
generic map(M=>4)
port map
( input1 => input1, output1 => output1);
end test_EGC;
-----------------------------------------------------
..do file
---------------------------------------------------
vsim work.test_EGC
view wave
add wave sim:/test_egc/output1
add wave sim:/test_egc/input1
add wave sim:/test_egc/u_egc/out1
run 500ns
--------------------------------------------------
Thank you,
Hongyan
-----------------------------------------------------------
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity EGC is
generic(M : natural := 4);
Port ( input1 : in std_logic_vector(15 downto 0);
output1 : out std_logic_vector(15 downto 0));
end EGC;
architecture Behavioral of EGC is
subtype vector16 is std_logic_vector(15 downto 0);
type vector_M_16_Out is array(0 to M) of vector16;
signal out1: vector_M_16_Out;
begin
out1(0) <= input1;
proc0 : process(out1, input1)
begin
--out1(0) <= input1;
for i in 1 to M loop
out1(i) <= 2+out1(i-1);
end loop;
end process proc0;
output1 <= out1(M);
end Behavioral;
-----------------------------------------------
It is very strange that it doesn't work this way. All the signals
out1(0-4) are xxxx. But if I put "out1(0) <= input1;" into the
process, it works fine.
I can't understand this because the for loop in the process won't
modify the out1(0). Did I miss somthing? Any suggestions will be
appreciate.
For your convience, here is my test file and .do file:
test file
-----------------------------------------------
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
------------------------entity Declaration----------------------------
entity test_EGC is
end test_EGC;
------------------------ Architecture Declaration
----------------------
architecture test_EGC of test_EGC is
signal output1, input1: std_logic_vector(15 downto 0);
component EGC
generic(M : natural := 4);
Port ( input1 : in std_logic_vector(15 downto 0);
output1 : out std_logic_vector(15 downto 0));
end component;
begin
proc_input1 : process is
begin
input1 <= X"0001";
wait for 60 ns;
input1 <= X"0000";
wait;
end process proc_input1; --proc_reset : process is
U_EGC : EGC
generic map(M=>4)
port map
( input1 => input1, output1 => output1);
end test_EGC;
-----------------------------------------------------
..do file
---------------------------------------------------
vsim work.test_EGC
view wave
add wave sim:/test_egc/output1
add wave sim:/test_egc/input1
add wave sim:/test_egc/u_egc/out1
run 500ns
--------------------------------------------------
Thank you,
Hongyan