daisyzari
Junior Member level 3

I'm having difficulty understanding this part of code that I've been using in my I2C project.
I actually need to translate this code into a logical circuit. And so it is important that I understand this code.
Can anyone pls help me understand and translate this code into a logical circuit?
Thank you :grin:
Code:
gen_clken: process(clk, nReset)
begin
if (nReset = '0') then
cnt <= (others => '0');
clk_en <= '1'; --'0';
elsif (clk'event and clk = '1') then
if (cnt = 0) then
clk_en <= '1';
cnt <= clk_cnt; -- loading of clk_cnt when clk_en is disabled
else
if (slave_wait = '0') then
cnt <= cnt -1;
end if;
clk_en <= '0';
end if;
end if;
end process gen_clken;
I actually need to translate this code into a logical circuit. And so it is important that I understand this code.
Can anyone pls help me understand and translate this code into a logical circuit?
Thank you :grin: