A
akrlot
Guest
hi;
i wanna kode mesin negara dengan counter.there 's 10 siklus antara negara k_fv
dan k_fo (incerement couter 0-9) dan 15 siklus antara k_fo dan k_fr dan
1cycle antara k_fr dan k_fv.thx in advance.
ini kode saya tapi kalau simulasi it doesnt ingin memberikan result.thx
library IEEE;
menggunakan ieee.std_logic_1164.all;
feu_ctl entitas adalah
generic (ukuran: integer: = 15);
port (CLK: di std_logic;
rst_n: di std_logic;
o_fv: keluar std_logic;
o_fo: keluar std_logic;
o_fr: keluar std_logic);
feu_ctl akhir;
arsitektur ARCH dari feu_ctl adalah
Jenis feu_state adalah (k_fv, k_fo, k_fr);
sinyal feu_fsm_d, feu_fsm_q: feu_state;
sinyal cpt_q, cpt_d: integer;
mulai
p1: process (CLK, rst_n)
mulai
if (rst_n = '0 ') maka feu_fsm_q <= k_fr;
cpt_q <= 0;
elsif CLK = '1 'dan clk'event kemudian feu_fsm_q <= feu_fsm_d;
cpt_q <= cpt_d;
end if;
proses akhir p1;
p2: process (feu_fsm_q, cpt_q)
mulai
jika cpt_q = ukuran-1 kemudian cpt_d <= 0;
lain cpt_d <= cpt_q 1;
end if;
feu_fsm_q kasus adalah
ketika k_fv => o_fv <= '1 '; o_fo <= '0'; o_fr <= '0 '; feu_fsm_d <= k_fo;
ketika k_fo => jika cpt_q = 10 maka
o_fo <= '1 '; o_fr <= '0'; o_fv <= '0 '; feu_fsm_d <= k_fr; cpt_d <= 0;
end if;
ketika k_fr => jika cpt_q = 1 maka
o_fr <= '1 '; o_fv <= '0'; o_fo <= '0 '; feu_fsm_d <= k_fv; cpt_d <= 0;
end if;
kasus akhir;
proses akhir p2;
ARCH akhir;
i wanna kode mesin negara dengan counter.there 's 10 siklus antara negara k_fv
dan k_fo (incerement couter 0-9) dan 15 siklus antara k_fo dan k_fr dan
1cycle antara k_fr dan k_fv.thx in advance.
ini kode saya tapi kalau simulasi it doesnt ingin memberikan result.thx
library IEEE;
menggunakan ieee.std_logic_1164.all;
feu_ctl entitas adalah
generic (ukuran: integer: = 15);
port (CLK: di std_logic;
rst_n: di std_logic;
o_fv: keluar std_logic;
o_fo: keluar std_logic;
o_fr: keluar std_logic);
feu_ctl akhir;
arsitektur ARCH dari feu_ctl adalah
Jenis feu_state adalah (k_fv, k_fo, k_fr);
sinyal feu_fsm_d, feu_fsm_q: feu_state;
sinyal cpt_q, cpt_d: integer;
mulai
p1: process (CLK, rst_n)
mulai
if (rst_n = '0 ') maka feu_fsm_q <= k_fr;
cpt_q <= 0;
elsif CLK = '1 'dan clk'event kemudian feu_fsm_q <= feu_fsm_d;
cpt_q <= cpt_d;
end if;
proses akhir p1;
p2: process (feu_fsm_q, cpt_q)
mulai
jika cpt_q = ukuran-1 kemudian cpt_d <= 0;
lain cpt_d <= cpt_q 1;
end if;
feu_fsm_q kasus adalah
ketika k_fv => o_fv <= '1 '; o_fo <= '0'; o_fr <= '0 '; feu_fsm_d <= k_fo;
ketika k_fo => jika cpt_q = 10 maka
o_fo <= '1 '; o_fr <= '0'; o_fv <= '0 '; feu_fsm_d <= k_fr; cpt_d <= 0;
end if;
ketika k_fr => jika cpt_q = 1 maka
o_fr <= '1 '; o_fv <= '0'; o_fo <= '0 '; feu_fsm_d <= k_fv; cpt_d <= 0;
end if;
kasus akhir;
proses akhir p2;
ARCH akhir;