Logic circuits · Circuitos lógicos
| English | Português |
|---|---|
| logic circuit/ˈlɒdʒɪk ˈsɜːkɪt/ | circuito lógico |
| Boolean expression/ˈbuːlɪən ekˈspreʃn/ | expressão booleana |
| problem statement/ˈprɒbləm ˈsteɪtmənt/ | enunciado do problema |
| truth table/truːθ ˈteɪbl/ | tabela-verdade |
| sum of products/sʌm ɒv ˈprɒdʌkts/ | soma de produtos |
| half adder/hɑːf ˈædə/ | meio somador |
Three sensors, two gates, one decision
- A microwave oven heats only when the door is closed and the start button has been pressed and the timer has not reached zero.
- Three sensors give three 0/1 signals. Two AND gates combine them into one signal that switches the magnetron. Open the door and the output drops to 0 at once.
- Every safety interlock, every alarm and every processor instruction is a decision like this, built from the six gates of the last lesson.
- This lesson is about building and reading those circuits, and moving between the four ways of writing the same decision.
Três sensores, duas portas, uma decisão
- Um micro-ondas aquece apenas quando a porta está fechada e o botão de início foi pressionado e o temporizador não atingiu zero.
- Três sensores fornecem três sinais 0/1. Duas portas AND combinam-nas em um único sinal que aciona o magnetron. Abrir a porta faz a saída cair para 0 imediatamente.
- Todo intertravamento de segurança, todo alarme e toda instrução de processador é uma decisão como esta, construída a partir das seis portas da última aula.
- Esta aula trata de construir e ler esses circuitos, e transitar entre as quatro formas de escrever a mesma decisão.
Four views of one function
- A logic circuit 逻辑电路 is a network of gates that carries out a Boolean expression 布尔表达式.
- The same function can be written as a problem statement 问题陈述 in English, as an expression, as a circuit diagram, or as a truth table 真值表. The exam asks you to move in every direction between them.
- The paper writes expressions in words,
X = (A AND NOT B) OR (B AND C), and accepts the algebraic form $X = A\overline{B} + BC$, where a dot or nothing is AND, a plus is OR and a bar is NOT. Use whichever the question uses.
Gates wired together to carry out one Boolean expression
Quatro vistas de uma função
- Um circuito lógico 逻辑电路 é uma rede de portas que executa uma expressão booleana 布尔表达式.
- A mesma função pode ser escrita como um enunciado do problema 问题陈述 em inglês, como uma expressão, como um diagrama de circuito ou como uma tabela-verdade 真值表. O exame pede para transitar em todas as direções entre elas.
- A prova escreve expressões em palavras,
X = (A AND NOT B) OR (B AND C), e aceita a forma algébrica $X = A\overline{B} + BC$, onde um ponto ou nada é AND, um mais é OR e uma barra é NOT. Use qualquer uma que a questão utilize.

Portas ligadas para executar uma expressão booleana
Expression to circuit
- Draw one gate per operator, starting from the innermost brackets.
- For
X = (A AND B) OR (NOT C): an AND gate on A and B, a NOT gate on the C wire, and an OR gate combining the two results. - Inputs on the left, the single output on the right, every line ending at a gate input or the output, and the output labelled X.
One gate for each operator in the expression
Expressão para circuito
- Desenhe uma porta por operador, começando pelos parênteses mais internos.
- Para
X = (A AND B) OR (NOT C): uma porta AND em A e B, uma porta NOT no fio C, e uma porta OR combinando os dois resultados. - Entradas à esquerda, a única saída à direita, cada linha terminando em uma entrada de porta ou na saída, e a saída rotulada como X.

Uma porta para cada operador na expressão
Logic circuits · Circuitos lógicos
gates combine into circuits · portas combinam para formar circuitos
Each gate has a fixed rule; chaining them builds every circuit — start with one gate. · Cada porta tem uma regra fixa; conectá-las constrói todos os circuitos — comece com uma porta.
For · A favor $X = (A \cdot B) + \overline{C}$ with $A=1, B=1, C=1$, what is $X$? · Para $X = (A \cdot B) + \overline{C}$ com $A=1, B=1, C=1$, qual é $X$?
$A \cdot B = 1$, and $\overline{C} = 0$. $X = 1 + 0 = 1$. · $A \cdot B = 1$, e $\overline{C} = 0$. $X = 1 + 0 = 1$.
Worked example: circuit to expression
- Work forwards from the inputs and label every intermediate output.
- In the circuit below, B passes through a NOT gate. A and NOT B feed an AND gate: call its output P, so
P = A AND NOT B. B and C feed a second AND gate:Q = B AND C. - P and Q feed the OR gate, so
X = P OR Q = (A AND NOT B) OR (B AND C). - Labelling P and Q is not decoration. It is what lets you fill the truth table one gate at a time.
Label every intermediate output before you write the expression
Exemplo resolvido: circuito para expressão
- Trabalhe da esquerda para a direita a partir das entradas e rotule cada saída intermediária.
- No circuito abaixo, B passa por uma porta NOT. A e NOT B alimentam uma porta AND: chame sua saída de P, então
P = A AND NOT B. B e C alimentam uma segunda porta AND:Q = B AND C. - P e Q alimentam a porta OR, então
X = P OR Q = (A AND NOT B) OR (B AND C). - Rotular P e Q não é decoração. É o que permite preencher a tabela-verdade porta por porta.

Rotule cada saída intermediária antes de escrever a expressão
In the worked circuit, the second AND gate's output is Q = B AND ____. · No circuito resolvido, a saída da segunda porta AND é Q = B AND ____.
B and C feed the lower AND gate. Labelling that output Q lets the truth table be filled one gate at a time. · B e C alimentam a porta AND inferior. Rotular essa saída como Q permite preencher a tabela-verdade porta por porta.
Circuit to truth table
- For $n$ inputs there are $2^{n}$ rows: two inputs give 4, three give 8, four give 16. List them in binary counting order.
- Give the table a column for each intermediate output as well as the final one, so every row is checked one gate at a time.
- Fill the columns left to right: first the NOT, then each AND, then the OR.
Circuito para tabela-verdade
- Para $n$ entradas existem $2^{n}$ linhas: duas entradas dão 4, três dão 8, quatro dão 16. Liste-as em ordem de contagem binária.
- Dê à tabela uma coluna para cada saída intermediária além da final, para que cada linha seja verificada porta por porta.
- Preencha as colunas da esquerda para a direita: primeiro a NOT, depois cada AND, depois a OR.
How many rows does a truth table have for a circuit with 3 inputs? · Quantas linhas tem uma tabela-verdade para um circuito com 3 inputs?
$2^n$ rows; for 3 inputs, $2^3 = 8$. · $2^n$ linhas; para 3 inputs, $2^3 = 8$.
How many rows for 4 inputs? · Quantas linhas para 4 inputs?
$2^4 = 16$ rows. · $2^4 = 16$ linhas.
Worked example: the eight rows
- The circuit from the worked example above, with columns for NOT B, P, Q and X:
| A | B | C | NOT B | P | Q | X |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 1 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 |
- X is 1 in four of the eight rows. Check any one against the expression: row 1 0 0 has A = 1 and NOT B = 1, so P = 1, so X = 1.
Exemplo resolvido: as oito linhas
- O circuito do exemplo resolvido acima, com colunas para NOT B, P, Q e X:
| A | B | C | NOT B | P | Q | X |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 1 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 0 | 0 | 1 | 1 |
- X é 1 em quatro das oito linhas. Verifique qualquer uma contra a expressão: a linha 1 0 0 tem A = 1 e NOT B = 1, então P = 1, então X = 1.
For · A favor X = (A AND NOT B) OR (B AND C), which of these input rows give X = 1? Select all · todos that apply. · Para X = (A AND NOT B) OR (B AND C), quais dessas linhas de input dão X = 1? Selecione todas as aplicáveis.
Row 011 makes Q = 1; row 100 makes P = 1. In row 110, B = 1 kills P and C = 0 kills Q; in row 001 both terms are 0. · A linha 011 faz Q = 1; a linha 100 faz P = 1. Na linha 110, B = 1 anula P e C = 0 anula Q; na linha 001 ambos os termos são 0.
Truth table to expression: sum of products
- Sum of products 积之和: for each row whose output is 1, write an AND of the inputs, putting NOT on any input that is 0 in that row. Then OR those terms together.
- A table that is 1 only on (A = 0, B = 1) and (A = 1, B = 0) gives
(NOT A AND B) OR (A AND NOT B), which is exactly A XOR B. - Simplify only if the question asks; the unsimplified sum of products earns the marks.
Tabela-verdade para expressão: soma de produtos
- Soma de produtos 积之和: para cada linha cuja saída é 1, escreva um AND das entradas, colocando NOT em qualquer entrada que seja 0 nessa linha. Em seguida, OR esses termos juntos.
- Uma tabela que é 1 apenas em (A = 0, B = 1) e (A = 1, B = 0) dá
(NOT A AND B) OR (A AND NOT B), que é exatamente A XOR B. - Simplifique apenas se a questão pedir; a soma de produtos não simplificada ganha os pontos.
In the sum-of-products method, for each row whose output is 1 you write: · No método soma-de-produtos, para cada linha cuja saída é 1 você escreve:
Each 1-row becomes an AND term (NOT the 0 inputs); you then OR all those terms together. · Cada linha-1 torna-se um termo AND (NOT nos inputs 0); você então ORa todos esses termos juntos.
In sum-of-products, you OR together one AND-term for every row whose output is 1. · Na soma-de-produtos, você ORa juntos um termo AND para cada linha cuja saída é 1.
Each output-1 row becomes an AND term (NOT-ing the 0 inputs); ORing those terms gives an expression that is 1 on exactly those rows. · Cada linha de saída-1 torna-se um termo AND (negando os inputs 0); ORar esses termos dá uma expressão que é 1 exatamente naquelas linhas.
The half adder
- Adding two bits gives a sum bit and a carry bit: 1 + 1 = 10 in binary.
- The sum column is 0, 1, 1, 0, which is XOR. The carry column is 0, 0, 0, 1, which is AND. Two gates make a half adder 半加器.
- It is the standard example of reading gates straight off a truth table, and the first piece of every processor's arithmetic unit.
Each input pair flows through the gates: XOR gives the sum, AND gives the carry, so 1 + 1 = 10
O somador parcial
- Somar dois bits dá um bit de soma e um bit de transporte: 1 + 1 = 10 em binário.
- A coluna de soma é 0, 1, 1, 0, que é XOR. A coluna de transporte é 0, 0, 0, 1, que é AND. Duas portas fazem um somador parcial 半加器.
- É o exemplo padrão de ler portas diretamente de uma tabela-verdade, e a primeira peça da unidade aritmética de todo processador.
Cada par de entradas flui pelas portas: XOR dá a soma, AND dá o transporte, então 1 + 1 = 10
Half adder · Somador parcial
Wire XOR and AND to the same two inputs: XOR gives the sum bit, AND gives the carry. Click A and B. · Conecte XOR e AND aos mesmos dois inputs: XOR gera o bit de soma, AND gera o carry. Clique em A e B.
In a half adder, which gate produces the carry bit? · Em um somador parcial, qual porta produz o bit de carry?
The carry is 1 only when both bits are 1, which is AND. The sum is 1 when the bits differ, which is XOR. · O carry é 1 apenas quando ambos os bits são 1, o que é AND. A soma é 1 quando os bits diferem, o que é XOR.
From a problem statement
- Turn the English into Boolean one clause at a time before drawing anything.
- "A and B" is
A AND B. "A or B, or both" isA OR B. "exactly one of A and B" isA XOR B. - "neither A nor B" is
A NOR B. "not both" isA NAND B. "unless" usually means AND NOT.
De um enunciado do problema
- Transforme o inglês em Booleano uma cláusula por vez antes de desenhar algo.
- "A e B" é
A AND B. "A ou B, ou ambos" éA OR B. "exatamente um de A e B" éA XOR B. - "nenhum A nem B" é
A NOR B. "não ambos" éA NAND B. "a menos que" geralmente significa AND NOT.
Match each English phrase to the single gate that implements it. · Combine cada frase em inglês à única porta que a implementa.
both = AND, differ = XOR, neither = NOR, not-both = NAND. · ambos = AND, diferem = XOR, nem = NOR, não-ambos = NAND.
Worked example: a machine alarm
- An alarm X sounds when the guard is open (A = 1) and either the motor is running (B = 1) or the temperature is high (C = 1).
- "Either B or C" is
B OR C. "A and that" isX = A AND (B OR C). The brackets around the OR are essential. - X = 1 needs A = 1 and at least one of B, C equal to 1: the rows (1, 0, 1), (1, 1, 0) and (1, 1, 1). Three rows out of eight, and A = 0 can never sound the alarm.
- The circuit is one OR gate on B and C feeding one AND gate with A.
Exemplo resolvido: um alarme de máquina
- Um alarme X soa quando a proteção está aberta (A = 1) e ou o motor está funcionando (B = 1) ou a temperatura está alta (C = 1).
- "Ou B ou C" é
B OR C. "A e isso" éX = A AND (B OR C). Os parênteses ao redor do OR são essenciais. - X = 1 precisa de A = 1 e pelo menos um de B, C igual a 1: as linhas (1, 0, 1), (1, 1, 0) e (1, 1, 1). Três linhas de oito, e A = 0 nunca acionará o alarme.
- O circuito é uma porta OR em B e C alimentando uma porta AND com A.
For the alarm X = A AND (B OR C), the alarm can sound when A = 0 provided both B and C are 1. · Para o alarme X = A AND (B OR C), o alarme pode tocar quando A = 0 desde que B e C sejam ambos 1.
The AND with A means A = 1 is required in every row where X = 1. With A = 0 the output is 0 whatever B and C do. · O AND com A significa que A = 1 é necessário em toda linha onde X = 1. Com A = 0 a saída é 0 independentemente do que B e C façam.
Marks that slip away
A AND B OR Cwithout brackets is ambiguous, and the examiner reads it as you did not intend. Bracket the OR before ANDing it.- A wire that goes nowhere, or an output with no label, loses the circuit mark even when the gates are right.
- A NOT on an input is a gate on the diagram, not a bar written over the letter.
- Three inputs mean eight rows. A table with fewer rows cannot be marked as complete.
Marcas que escapam
A AND B OR Csem parênteses é ambíguo, e o examinador interpretará como você não pretendeu. Coloque parênteses no OR antes de ANDá-lo.- Um fio que não vai a lugar nenhum, ou uma saída sem rótulo, perde o ponto do circuito mesmo quando as portas estão corretas.
- Uma NOT em uma entrada é uma porta no diagrama, não uma barra escrita sobre a letra.
- Três entradas significam oito linhas. Uma tabela com fewer linhas não pode ser marcada como completa.
You've got it
- expression → circuit: one gate per operator, innermost brackets first, inputs left, labelled output right
- circuit → expression: label each intermediate output (P, Q) and combine; circuit → truth table: $2^{n}$ rows with a column per gate
- truth table → expression: sum of products, one AND-term per output-1 row, ORed together; XOR + AND make the half adder
- problem → Boolean: exactly one = XOR, neither = NOR, not both = NAND; bracket the OR inside an AND
Entendeu?
- expressão → circuito: uma porta por operador, parênteses mais internos primeiro, entradas à esquerda, saída rotulada à direita
- circuito → expressão: rotule cada saída intermediária (P, Q) e combine; circuito → tabela-verdade: $2^{n}$ linhas com uma coluna por porta
- tabela-verdade → expressão: soma de produtos, um termo AND por linha de saída-1, ORados juntos; XOR + AND formam o somador parcial
- problema → Booleano: exatamente um = XOR, nenhum = NOR, não ambos = NAND; coloque parênteses no OR dentro de um AND