Prof. Dr. Thorsten Jungmann (last updated 2026-10-13)

Relates to DET-02 Logic operations

Task

Parts of the logic of a heat pump could be described in VHDL, for example for a programmable logic device. You do not need to write such code, but you should recognize it and sketch the circuit that it describes. Subtask a) is based on exercises in the textbook by LaMeres [5, p. 186], subtask e) on a concept check [5, p. 180].

Design 1 releases the compressor:

-- Release of the compressor of a heat pump
entity compressor_release is
  port (D, B : in  bit;   -- D: demand for heat, B: blocking signal of the energy supplier
        R    : out bit);  -- R: compressor released
end entity;
 
architecture behaviour of compressor_release is
begin
  R <= D and not B;
end architecture;

a) Which part of design 1 describes the inputs and outputs, and which part describes the behaviour? Name each port with its direction and its type, and state the values that a port of type bit can take.

b) Sketch the circuit of design 1 according to the standard of the International Electrotechnical Commission (IEC), IEC 60617, and give its logic expression and its truth table.

Design 2 switches on a fault lamp:

-- Fault lamp of a heat pump
entity fault_lamp is
  port (C, P, Q : in  bit;   -- C: collective fault, P: command to switch the pump on,
                             -- Q: feedback that the pump is running
        L       : out bit);  -- L: fault lamp on
end entity;
 
architecture behaviour of fault_lamp is
  signal X1 : bit;           -- intermediate node
begin
  L  <= C or X1;
  X1 <= P xor Q;
end architecture;

c) Sketch the circuit of design 2 according to IEC 60617, and give its logic expression and its truth table, with a column for the intermediate node . What does a 1 at tell you about the pump?

d) Which of the following lines does VHDL accept? For each line that it does not accept, give the reason.

  • Line 1: Y <= A and B or C;
  • Line 2: Y <= (A and B) or C;
  • Line 3: Y <= A or B or C;
  • Line 4: Y <= A nor B nor C;
  • Line 5: Y <= not A and B;

e) In design 2, the output L is assigned before the intermediate node X1 that it uses. Does the circuit change if you swap the two assignments? Give the reason.

◀️ Back to the task


Solution

Given

Given explicitly:

  • Design 1: entity compressor_release with the inputs D, demand for heat, and B, blocking signal of the energy supplier, and the output R, compressor released; assignment R <= D and not B;
  • Design 2: entity fault_lamp with the inputs C, collective fault, P, command to switch the pump on, and Q, feedback that the pump is running, and the output L, fault lamp on; internal signal X1; assignments L <= C or X1; and X1 <= P xor Q;
  • d) five lines with signal assignments

Known:

  • Parts of a design in VHDL: the entity with its ports, each with name, direction and type, and the architecture with the behaviour; the type bit (DET-02)
  • One operator for each gate; only not takes precedence, all other logical operators have the same rank (DET-02)
  • From VHDL code to the circuit: each operator becomes a gate, each signal declared before begin an intermediate node; the assignments are concurrent (DET-02)
  • Schematic symbols according to the standard of the International Electrotechnical Commission (IEC), IEC 60617 (DET-02); XOR gate: 1 if its inputs differ (DET-02)
  • NOR is not associative (DET-02)

Required

a) the part for the inputs and outputs, the part for the behaviour, the ports with direction and type, the values of bit
b) and c) the circuits, logic expressions and truth tables of designs 1 and 2; in c) also the meaning of
d) the lines that VHDL accepts, with the reason for each line that it does not accept
e) whether swapping the assignments changes the circuit

a) Parts of design 1

A design in VHDL has two parts (DET-02, 2.8). The entity compressor_release describes the interface: its port list names the inputs and outputs. The architecture behaviour describes the behaviour, here with a single signal assignment.

PortDirectionTypeMeaning
Din, inputbitdemand for heat
Bin, inputbitblocking signal of the energy supplier
Rout, outputbitcompressor released

A port of type bit takes only the two values 0 and 1, written '0' and '1' in VHDL [5, p. 166].

b) Circuit of design 1

The operator not becomes an inverter for , and and becomes an AND gate that combines with the inverted (DET-02, 6.4):

Circuit of design 1 according to IEC 60617, in which D and the input B, inverted by an inverter, feed an AND gate that delivers the release R.
Circuit of design 1 according to IEC 60617, in which D and the input B, inverted by an inverter, feed an AND gate that delivers the release R.

0010
0100
1011
1100

The compressor is released only in row 2, counting from row 0: there is a demand for heat, and the energy supplier does not block the operation.

Check with the precedence of VHDL: not acts only on B, so that D and not B means and not ✓

c) Circuit of design 2

The architecture declares the signal X1 before begin: it is an intermediate node inside the circuit. The operator xor becomes an XOR gate for and with the output , and or becomes an OR gate for and with the output . The simulation shows the circuit:

Simulation of the fault lamp with an XOR gate for P and Q and an OR gate for C and X1, in which only P is high, so that the lamp L is on.
Simulation of the fault lamp with an XOR gate for P and Q and an OR gate for C and X1, in which only P is high, so that the lamp L is on.

Open in the simulator

00000
00111
01011
01100
10001
10111
11011
11101

The lamp is off only in rows 0 and 3: without a collective fault and with a pump that follows its command, whether it is switched off (row 0) or on (row 3).

is 1 if command and feedback differ: either the pump runs although it should be off, or it should run but does not. A 1 at therefore means that the pump does not follow its command; it is the inverted output of the XNOR gate that checks whether command and feedback agree (DET-02, 4.4).

Check of row 3 with the expression. For , and :

✓

In the simulation, you can switch the three inputs through all eight combinations and compare each result with a row of the table.

d) Lines that VHDL accepts

In VHDL, only not takes precedence; all other logical operators have the same rank. Without parentheses, an expression may therefore only chain the same operator, and nand and nor not even that (DET-02, 5.2):

LineCodeAcceptedReason or meaning
1Y <= A and B or C;nomixes and and or without parentheses
2Y <= (A and B) or C;yes
3Y <= A or B or C;yesthe same operator three times:
4Y <= A nor B nor C;nonor cannot be chained
5Y <= not A and B;yesnot takes precedence:

Line 1 needs parentheses that state what is meant: (A and B) or C, as in line 2, or A and (B or C). Line 4 is rejected because NOR is not associative (DET-02, 5.4): the grouping changes the result. For , and :

(A nor B) nor C gives 1, A nor (B nor C) gives 0.

Check with the examples of the lesson (DET-02, 5.2): there, too, Y <= A and B or C; and A nor B nor C are rejected for these reasons, and Y <= (A and B) or C; is correct ✓

e) Order of the assignments

No. The two assignments are concurrent: each of them describes a piece of hardware, here a gate, and both gates work at the same time (DET-02, 6.4). Unlike the lines of a program, they are not executed one after another. Whether L <= C or X1; stands before or after X1 <= P xor Q;, the XOR gate drives the node , and the OR gate combines it with : the circuit and its truth table stay the same.

Why concurrency matters

In hardware, all gates work at the same time, as soon as they are supplied with power. A language that describes hardware must therefore describe things that happen in parallel [5, p. 180].