J
Jyrki Takalo-Kastari
Guest
Hi all,
Here is the simplified version of the code I'm having trouble to
understand why it simulates as it does. It's behavioral code and not
supposed to be synthesized.
Problematic line is the one I marked with ***. When the simulator gets to
that line for some reason the value of d is not the value of coe_imexi_d
but the previous value. Once I run through the rest of the process, the
wave window shows that the value of d is the same as value of coe_imexi_d
at that time. Am I missing something here, because I've always thought
that the signals should be the same if assigned the way I've done here? If
I use coe_imexi_d instead of d on that line it works as it should, but I'd
like to understand what is behind this behaviour.
ARCHITECTURE sim OF vb IS
SIGNAL hsync : std_logic;
SIGNAL vsync : std_logic;
SIGNAL pclk : std_logic;
SIGNAL gReset : std_logic;
SIGNAL d : std_logic_vector(11 DOWNTO 0);
SIGNAL clk : std_logic;
BEGIN -- ARCHITECTURE sim
-- These are used to rename some of the entity signals
hsync <= coe_imexi_hsync;
vsync <= coe_imexi_vsync;
pclk <= coe_imexi_pclk;
gReset <= coe_imexi_gReset;
d <= coe_imexi_d;
clk <= csi_imclk_clk;
get_data : PROCESS (pclk, clk, gReset) IS
VARIABLE pixel : IM_PIXEL_BUS := (OTHERS => '0');
VARIABLE new_pixel : boolean := FALSE;
BEGIN -- PROCESS get_data
IF gReset = '1' THEN
-- reset output registers
ELSE
IF rising_edge(pclk) THEN
IF hsync = '1' AND vsync = '1' THEN
*** pixel := d;
new_pixel := TRUE;
END IF;
END IF;
IF rising_edge(clk) THEN
-- do something else
END IF;
END IF;
END PROCESS get_data;
END ARCHITECTURE sim;
Here is the simplified version of the code I'm having trouble to
understand why it simulates as it does. It's behavioral code and not
supposed to be synthesized.
Problematic line is the one I marked with ***. When the simulator gets to
that line for some reason the value of d is not the value of coe_imexi_d
but the previous value. Once I run through the rest of the process, the
wave window shows that the value of d is the same as value of coe_imexi_d
at that time. Am I missing something here, because I've always thought
that the signals should be the same if assigned the way I've done here? If
I use coe_imexi_d instead of d on that line it works as it should, but I'd
like to understand what is behind this behaviour.
ARCHITECTURE sim OF vb IS
SIGNAL hsync : std_logic;
SIGNAL vsync : std_logic;
SIGNAL pclk : std_logic;
SIGNAL gReset : std_logic;
SIGNAL d : std_logic_vector(11 DOWNTO 0);
SIGNAL clk : std_logic;
BEGIN -- ARCHITECTURE sim
-- These are used to rename some of the entity signals
hsync <= coe_imexi_hsync;
vsync <= coe_imexi_vsync;
pclk <= coe_imexi_pclk;
gReset <= coe_imexi_gReset;
d <= coe_imexi_d;
clk <= csi_imclk_clk;
get_data : PROCESS (pclk, clk, gReset) IS
VARIABLE pixel : IM_PIXEL_BUS := (OTHERS => '0');
VARIABLE new_pixel : boolean := FALSE;
BEGIN -- PROCESS get_data
IF gReset = '1' THEN
-- reset output registers
ELSE
IF rising_edge(pclk) THEN
IF hsync = '1' AND vsync = '1' THEN
*** pixel := d;
new_pixel := TRUE;
END IF;
END IF;
IF rising_edge(clk) THEN
-- do something else
END IF;
END IF;
END PROCESS get_data;
END ARCHITECTURE sim;