kkdelabaca
Full Member level 2
hello,
I'm designing my first code in VHDL to create one UART.
The principal CLK works at 60MHz, and I need divide the principal CLK for decrease the speed of the UART.
It's normal create one process with one divided clk (signal COUNT(1))? or exist other designs more efficients?
architecture fsm_sencilla of UART_TX is
type estado is (S0,S1,S2,S3,D0,D1,D2); -- 7 states
signal estado_pr, sig_estado: estado; -- Present and future State
signal COUNT: unsigned(7 downto 0):= "00000000"; -- Counter to divide the clk
signal Aint, Bint, Cint: std_logic; -- Save inputs in State S3 ('0' sync)
begin
process(clk, rst) begin
if rst='1' then
COUNT <= "00000000";
elsif (clk'event and clk='1') then
COUNT <= COUNT + 1;
end if;
end process;
process(rst, Aint, Bint, Cint, COUNT(1)) begin
if rst='1' then
estado_pr <= S0; elsif (COUNT(1)'event and COUNT(1)='1') then
estado_pr <= sig_estado;
if estado_pr= S2 then Aint <= A;
Bint <= B;
Cint <= C;
end if;
end if;
end process;
I'm designing my first code in VHDL to create one UART.
The principal CLK works at 60MHz, and I need divide the principal CLK for decrease the speed of the UART.
It's normal create one process with one divided clk (signal COUNT(1))? or exist other designs more efficients?
architecture fsm_sencilla of UART_TX is
type estado is (S0,S1,S2,S3,D0,D1,D2); -- 7 states
signal estado_pr, sig_estado: estado; -- Present and future State
signal COUNT: unsigned(7 downto 0):= "00000000"; -- Counter to divide the clk
signal Aint, Bint, Cint: std_logic; -- Save inputs in State S3 ('0' sync)
begin
process(clk, rst) begin
if rst='1' then
COUNT <= "00000000";
elsif (clk'event and clk='1') then
COUNT <= COUNT + 1;
end if;
end process;
process(rst, Aint, Bint, Cint, COUNT(1)) begin
if rst='1' then
estado_pr <= S0; elsif (COUNT(1)'event and COUNT(1)='1') then
estado_pr <= sig_estado;
if estado_pr= S2 then Aint <= A;
Bint <= B;
Cint <= C;
end if;
end if;
end process;