- 2078 Poush
VHDL dataflow/behavioural models; JK flip-flop
Short answer
Dataflow uses concurrent signal assignments (Boolean equations); behavioural uses a process with sequential statements. A JK flip-flop process with asynchronous reset: on rising edge, JK=00 holds, 01 resets, 10 sets, 11 toggles, using internal q_int.
Explain dataflow and behavioural models in VHDL. Write a VHDL code for a JK flip-flop using PROCESS.
Dataflow model
The dataflow model describes a circuit by concurrent signal assignments that show how data flows from inputs to outputs, using Boolean equations or when ... else / with ... select. The order of statements does not matter; each statement is evaluated whenever a signal on its right-hand side changes.
-- dataflow description of a half adder
sum <= a xor b;
carry <= a and b;
Behavioural model
The behavioural model describes what the circuit does in an algorithmic way, using a process with sequential statements (if, case, loop). It does not say which gates are used. It is the best model for sequential circuits such as flip-flops, counters and state machines.
| Point | Dataflow | Behavioural |
|---|---|---|
| Statements | Concurrent assignments | Sequential statements inside a process |
| Describes | Flow of data / Boolean equations | Algorithm / functionality |
| Typical use | Combinational logic | Sequential logic and FSMs |
JK flip-flop using a process
Characteristic table: JK = 00 hold, 01 reset, 10 set, 11 toggle.
library ieee;
use ieee.std_logic_1164.all;
entity jkff is
port (
clk : in std_logic;
rst : in std_logic; -- asynchronous reset, active high
j : in std_logic;
k : in std_logic;
q : out std_logic;
qn : out std_logic
);
end entity jkff;
architecture behavioral of jkff is
signal q_int : std_logic := '0'; -- internal copy of the state
begin
process (clk, rst)
begin
if rst = '1' then
q_int <= '0';
elsif rising_edge(clk) then
if j = '0' and k = '0' then q_int <= q_int; -- hold
elsif j = '0' and k = '1' then q_int <= '0'; -- reset
elsif j = '1' and k = '0' then q_int <= '1'; -- set
else q_int <= not q_int; -- toggle
end if;
end if;
end process;
q <= q_int;
qn <= not q_int;
end architecture behavioral;
The process is sensitive to clk and rst. The internal signal q_int is used so that q can be read back for the toggle and for qn. The code was analysed and simulated with GHDL for set, hold, toggle and reset.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- VHDL COMPONENT; JK flip-flop with PROCESS · Embedded System, chapter 9
- VHDL entity, architecture; D flip-flop · Embedded System, chapter 9
- VHDL entity declaration; T flip-flops circuit · Embedded System, chapter 9
- VHDL models; full adder structural · Embedded System, chapter 9
- VHDL PROCESS; full adder with half adders · Embedded System, chapter 9
- SR drawback; edge triggered JK flip-flop · Digital Logic, chapter 6 · asked 3×
- SR to JK flip-flop conversion · Digital Logic, chapter 6 · asked 2×
- JK flip-flop characteristic and excitation tables · Digital Logic, chapter 6 · asked 2×
- T to JK flip-flop conversion · Digital Logic, chapter 6 · asked 2×