kurukuru
Junior Member level 1
code style one hot
Hi all,
I am a newbie in FPGA using VHDL language, I was told by my friend to try to write my code using state machine coz it easy to read and debug. I have coded my circuit as shown below and I’m wondering that whether this coding style called one-hot or not? (FYI, I have read many posts about one-hot coding theory but not quite understand how it looks like in VHDL code) Or if it not one-hot, how should I fix my code to be one-hot coding?
Thank you very much in advance
kurukuru
Hi all,
I am a newbie in FPGA using VHDL language, I was told by my friend to try to write my code using state machine coz it easy to read and debug. I have coded my circuit as shown below and I’m wondering that whether this coding style called one-hot or not? (FYI, I have read many posts about one-hot coding theory but not quite understand how it looks like in VHDL code) Or if it not one-hot, how should I fix my code to be one-hot coding?
Thank you very much in advance
kurukuru
Code:
process (CLK, RST_L)
begin
if (RST_L = '0') then
wWR_EN <= '0';
wWRITE_STATE <= WAIT_DATA;
elsif (CLK'event and CLK = '1') then
case wWRITE_STATE is
when WAIT_DATA =>
wWR_EN <= '0';
if (wBYTE_COMPLETE = '1') then
wWRITE_STATE <= START_WRITE;
else
wWRITE_STATE <= WAIT_DATA;
end if;
when START_WRITE =>
wWR_EN <= '0';
wWRITE_DATA <= wDATA_BUFFER (8 downto 1);
wWRITE_STATE <= WRITING;
when WRITING =>
wWR_EN <= '1';
wWRITE_STATE <= WAIT_DATA;
end case;
end if;
end process;