Consider the following VHDL process inside a synchronous design. What will be the value of q after the rising edge of clk if reset is '0' and d is '1'?
process(clk, reset) begin if reset = '1' then q <= '0'; elsif rising_edge(clk) then q <= d; end if; end process;
Remember that reset is asynchronous and active high.
Since reset is '0', the reset condition is not active. On the rising edge of clk, q takes the value of d, which is '1'.
Analyze the following VHDL process. What problem will synthesis tools report?
process(a, b) begin if a = '1' then y <= '1'; end if; end process;
Think about what happens to y when a is not '1'.
Because y is assigned only when a is '1', synthesis infers a latch to hold the previous value when a is not '1'.
Examine the following VHDL code snippet. What is the main synthesis issue?
process(clk) begin if rising_edge(clk) then if enable = '1' then q <= d; end if; end if; end process;
Consider what happens to q when enable is '0' on clock edge.
In clocked processes, signals keep their value if not assigned. This is normal and does not infer latches.
Identify the code snippet that will cause a syntax error during VHDL compilation.
Check for missing semicolons or keywords.
Option D is missing a semicolon after end if, causing a syntax error.
Given the following VHDL code, how many flip-flops will synthesis infer?
process(clk) begin if rising_edge(clk) then q1 <= d1; if enable = '1' then q2 <= d2; end if; end if; end process;
Remember that signals assigned inside a clocked process infer flip-flops.
Both q1 and q2 are assigned on the rising edge of clk, so two flip-flops are inferred. The conditional assignment to q2 inside the clocked process does not cause latch inference.
