I've written a VHDL design that halves the clock's frequency and outputs this 'data clock' onto the sclk pin. I also have a data pin called 'sda' that I'd like to send data out of. The following code works fine. I see the clock signal out of sclk and sda is permanently set to high. Enable is attached to a push button.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
-- For Main Clock --
library machXO3l;
use machXO3l.all;
--------------------
entity top is
-- entity's pin out.
port(
enable : in std_logic;
sda : out std_logic := '0';
sclk : out std_logic := '0'
);
end entity;
architecture top_behav of top is
signal temp_sclk : std_logic := '0';
signal clk : std_logic;
signal temp_sda : std_logic := '1';
signal stdby : std_logic := '0';
component OSCH
-- Component description that is being used within the entity.
-- synthesis translate_off
generic (NOM_FREQ: string := "24.18");
-- synthesis translate_on
port(
STDBY : in std_logic;
OSC : out std_logic
);
end component;
attribute NOM_FREQ : string;
attribute NOM_FREQ of OSCinst0 : label is "24.18";
begin
OSCinst0: OSCH
-- synthesis translate_off
generic map( NOM_FREQ => "24.18" )
-- synthesis translate_on
-- mapping the OSCH component to our entity pin out.
port map(
OSC => clk,
STDBY => stdby
);
-- DATA CLOCK GENERATION
sclk_p : process(clk, enable)
begin
if (enable = '0') then
temp_sclk <= '0';
elsif (clk'event and clk = '1') then
temp_sclk <= NOT temp_sclk;
end if;
end process;
sclk <= temp_sclk;
sda <= temp_sda;
end top_behav;
The problem is when I create the following process within the architecture, both lines are permanently set to 0. I don't understand why. Simulation works fine. I'm able to synthesize my code and program it on to the FPGA. But when monitoring the pins using a scope, they're just set to low.
sda_p : process(clk, enable)
begin
if (enable = '0') then
temp_sda <= '0';
else
temp_sda <= '1';
end if;
end process;
The following works fine too:
sda_p : process(clk, enable)
begin
temp_sda <= '1';
end process;
I'm using lattice diamond and machx03l evk