concurrencyparallel-processingvhdlexecutionsequential

Please, clarify the concept of sequential and concurrent execution in VHDL


I got familiar with a little bit of Verilog at school and now, one year later, I bought a Basys 3 FPGA board. My goal is to learn VHDL.

I have been reading a free book called "Free Range VHDL" which assists greatly in understanding the VHDL language. I have also searched through github repos containing VHDL code for reference.

My biggest concern is the difference between sequential and concurrent execution. I understand the meaning of these two words but I still cannot imagine why we can use "process" for combinational logic (i.e. seven segment decoder). I have implemented my seven segment decoder as conditional assignment of concurrent statements. What would be the difference if I implemented the decoder using process and a switch statement? I do not understand the word sequential execution of process when it comes to combinational logic. I would understand it if it was a sequential machine-a state machine.

Can somebody please explain this concept?

Here is my code for a seven-segment decoder:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity hex_display_decoder is
    Port ( D: in STD_LOGIC_VECTOR (3 downto 0);
       SEG_OUT : out STD_LOGIC_VECTOR (6 downto 0));
end hex_display_decoder;

architecture dataflow of hex_display_decoder is
begin
  with D select
      SEG_OUT <=  "1000000" when "0000",
                  "1111001" when "0001",
                  "0100100" when "0010",
                  "0110000" when "0011",
                  "0011001" when "0100",
                  "0010010" when "0101",
                  "0000010" when "0110",
                  "1111000" when "0111",
                  "0000000" when "1000",
                  "0010000" when "1001",
                  "0001000" when "1010",
                  "0000011" when "1011",
                  "1000110" when "1100",
                  "0100001" when "1101",
                  "0000110" when "1110",
                  "0001110" when "1111",
                  "1111111" when others;
end dataflow;

Thank you.


Solution

  • My biggest concern is difference between sequential and concurrent execution. I understand the meaning of these two words but I still cannot imagine why we can use "process" for combinational logic (ex. seven segment decoder).

    You are confounding two things:

    Types of logic

    In logic design:

    The following VHDL process is combinational:

    process(x, y) begin
        z <= x or y;
    end process;
    

    We know it is combinational because:

    The following VHDL process is sequential:

    process(clk) begin
        if rising_edge(clk) then
            if rst = '1' then
                z <= '0';
            else
                z <= z xor y;
            end if;
        end if;
    end process;
    

    We know it is sequential because:

    Model of Execution

    To make a long story short, processes are executed as follow in VHDL:

    Processes in Disguise

    So-called concurrent statements, essentially all statements outside a process, are actually processes in disguise. For example, this concurrent signal assignment (i.e. an assignment to a signal outside a process):

    z <= x or y;
    

    Is equivalent to this process:

    process(x, y) begin
        z <= x or y;
    end process;
    

    That is, it is equivalent to the same assignment within a process that has all of its inputs in the sensitivity list. And by equivalent, I mean the VHDL standard (IEEE 1076) actually defines the behaviour of concurrent signal assignments by their equivalent process.

    What that means is that, even though you didn't know it, this statement of yours in hex_display_decoder:

    SEG_OUT <=  "1000000" when "0000",
                "1111001" when "0001",
                "0100100" when "0010",
                "0110000" when "0011",
                "0011001" when "0100",
                "0010010" when "0101",
                "0000010" when "0110",
                "1111000" when "0111",
                "0000000" when "1000",
                "0010000" when "1001",
                "0001000" when "1010",
                "0000011" when "1011",
                "1000110" when "1100",
                "0100001" when "1101",
                "0000110" when "1110",
                "0001110" when "1111",
                "1111111" when others;
    

    is already a process.

    Which, in turn, means

    What would be the difference if I implemented the decoder using process and a switch statement?

    None at all.