Logic gates · Portas lógicas
| English | Português |
|---|---|
| logic gate/ˈlɒdʒɪk ɡeɪt/ | porta lógica |
| truth table/truːθ ˈteɪbl/ | tabela-verdade |
| Boolean/ˈbuːlɪən/ | Boolean |
| logic expression/ˈlɒdʒɪk ekˈspreʃn/ | expressão lógica |
The master's thesis that built the digital world
- In 1937 a 21-year-old student, Claude Shannon, noticed that the on-off relays in telephone exchanges behaved exactly like the true-false algebra George Boole had written a century earlier.
- His thesis showed that any logical statement could be built as a circuit of switches, and any circuit of switches described as a logical statement.
- Every processor made since is a very large number of those switches, arranged into a handful of standard logic gates 逻辑门.
- This lesson is the handful: six gates, their symbols, and their truth tables.
A tese de mestrado que construiu o mundo digital
- Em 1937, um estudante de 21 anos, Claude Shannon, notou que os relevés on-off nas centrais telefônicas se comportavam exatamente como a álgebra verdadeiro-falso que George Boole havia escrito um século antes.
- Sua tese mostrou que qualquer declaração lógica poderia ser construída como um circuito de chaves, e qualquer circuito de chaves descrito como uma declaração lógica.
- Todo processador feito desde então é um grande número dessas chaves, organizadas em um punhado de portas lógicas 逻辑门 padrão.
- Esta lição é o punhado: seis portas, seus símbolos e suas tabelas-verdade.
What a logic gate is
- A logic gate is a small circuit that carries out one Boolean 布尔 operation. Every input and every output is either 0 (false, low voltage) or 1 (true, high voltage).
- For each gate you must know three things: its symbol, its function in words, and its truth table 真值表, which lists the output for every combination of inputs.
- Every gate in this course has two inputs except NOT, which has one.
The six gates: a shape for each, and a bubble where the output is inverted
O que é uma porta lógica
- Uma porta lógica é um pequeno circuito que executa uma operação Booleana 布尔. Cada entrada e cada saída é 0 (falso, baixa tensão) ou 1 (verdadeiro, alta tensão).
- Para cada porta você deve saber três coisas: seu símbolo, sua função em palavras e sua tabela-verdade 真值表, que lista a saída para cada combinação de entradas.
- Todas as portas neste curso têm duas entradas exceto NOT, que tem uma.

As seis portas: uma forma para cada, e uma bolinha onde a saída é invertida
Logic gates · Portas lógicas
output from the truth table · saída da tabela-verdade
Toggle A and B through a gate and watch the truth table row light up. · Alternar A e B através de uma porta e assistir a linha da tabela-verdade iluminar.
NOT, AND, OR
- NOT inverts its single input: 0 becomes 1 and 1 becomes 0.
- AND outputs 1 only when both inputs are 1.
- OR outputs 1 when at least one input is 1, so it is 0 only when both inputs are 0.
| A | B | A AND B | A OR B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 |
NOT, AND, OR
- NOT inverte sua única entrada: 0 vira 1 e 1 vira 0.
- AND sai 1 apenas quando ambas as entradas são 1.
- OR sai 1 quando pelo menos uma entrada é 1, então sai 0 apenas quando ambas as entradas são 0.
| A | B | A AND B | A OR B |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 |
A NOT gate outputs 1 when its input is 0. · Uma porta NOT sai 1 quando sua entrada é 0.
NOT inverts: 0 → 1 and 1 → 0. · NOT inverte: 0 → 1 e 1 → 0.
An AND gate outputs 1 when: · Uma porta AND sai 1 quando:
AND outputs 1 only if every input is 1; otherwise 0. · AND sai 1 apenas se todas as entradas forem 1; caso contrário 0.
An OR gate outputs 0 only when: · Uma porta OR sai 0 apenas quando:
OR is 1 if at least one input is 1, so it is 0 only when every input is 0. · OR é 1 se pelo menos uma entrada for 1, logo é 0 apenas quando todas as entradas são 0.
NAND, NOR, XOR
- NAND is NOT AND: the output is 0 only when both inputs are 1, and 1 otherwise.
- NOR is NOT OR: the output is 1 only when both inputs are 0.
- XOR (exclusive OR, also written EOR) outputs 1 when the inputs are different, and 0 when they are the same.
| A | B | A NAND B | A NOR B | A XOR B |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 |
NAND, NOR, XOR
- NAND é NOT AND: a saída é 0 apenas quando ambas as entradas são 1, e 1 caso contrário.
- NOR é NOT OR: a saída é 1 apenas quando ambas as entradas são 0.
- XOR (OR exclusivo, também escrito EOR) sai 1 quando as entradas são diferentes, e 0 quando são iguais.
| A | B | A NAND B | A NOR B | A XOR B |
|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 0 |
A XOR gate outputs 1 when: · Uma porta XOR sai 1 quando:
XOR (exclusive OR) is 1 when the inputs differ (0,1 or 1,0) and 0 when they are the same. · XOR (OR exclusivo) é 1 quando as entradas diferem (0,1 ou 1,0) e 0 quando são iguais.
A NAND gate outputs 0 only when: · Uma porta NAND sai 0 apenas quando:
NAND = NOT AND, so it is 0 exactly when AND would be 1 (all inputs 1), and 1 otherwise. · NAND = NOT AND, então é 0 exatamente quando AND seria 1 (todas as entradas 1), e 1 caso contrário.
A NOR gate with both inputs 0 outputs what value (0 or 1)? · Uma porta NOR com ambas as entradas 0 sai qual valor (0 ou 1)?
NOR = NOT OR. OR of (0,0) is 0, so NOR is 1. NOR is 1 only when all inputs are 0. · NOR = NOT OR. OR de (0,0) é 0, então NOR é 1. NOR é 1 apenas quando todas as entradas são 0.
Worked example: building a truth table
- Task: construct the truth table for a NOR gate.
- Write the input columns A and B and list every combination in binary counting order: 00, 01, 10, 11. Four rows, never three, never repeated.
- Apply the rule to each row. NOR is 1 only when both inputs are 0, so the output column reads 1, 0, 0, 0.
- The order matters for the marks: the examiner compares your output column with the scheme row by row.
Exemplo resolvido: construindo uma tabela-verdade
- Tarefa: construir a tabela-verdade para uma porta NOR.
- Escreva as colunas de entrada A e B e liste todas as combinações em ordem de contagem binária: 00, 01, 10, 11. Quatro linhas, nunca três, nunca repetidas.
- Aplique a regra a cada linha. NOR sai 1 apenas quando ambas as entradas são 0, então a coluna de saída lê 1, 0, 0, 0.
- A ordem importa para os marks: o avaliador compara sua coluna de saída com o gabarito linha por linha.
Put the rows of a two-input truth table in the order the examiner expects. · Coloque as linhas de uma tabela-verdade de duas entradas na ordem esperada pelo examinador.
Binary counting order: 00, 01, 10, 11. The output column is then compared with the mark scheme row by row. · Ordem de contagem binária: 00, 01, 10, 11. A coluna de saída é então comparada com o gabarito linha por linha.
Worked example: defining a gate in words
- Task: define the function of an XOR gate.
- The mark-scheme wording: the output is 1 when the inputs are different, or equivalently when exactly one input is 1; the output is 0 when both inputs are the same.
- For NAND: the output is 0 only when both inputs are 1. For NOR: the output is 1 only when both inputs are 0.
- "Only when" and "at least one" are doing the work in these sentences. Leave them out and the definition also describes another gate.
Exemplo resolvido: definindo uma porta em palavras
- Tarefa: definir a função de uma porta XOR.
- A redação do gabarito: a saída é 1 quando as entradas são diferentes, ou equivalentemente quando exatamente uma entrada é 1; a saída é 0 quando ambas as entradas são iguais.
- Para NAND: a saída é 0 apenas quando ambas as entradas são 1. Para NOR: a saída é 1 apenas quando ambas as entradas são 0.
- "Apenas quando" e "pelo menos um" estão realizando o trabalho nestas frases. Remova-os e a definição também descreverá outra porta lógica.
Reading a symbol
- AND has a flat back and a rounded front, like a D. OR has a curved back and a pointed front. XOR is OR with an extra curved line across its inputs.
- A small circle, the bubble, on the output means "invert". AND with a bubble is NAND, OR with a bubble is NOR.
- NOT is a triangle with a bubble: one input, one output.
Flat back for AND, curved back for OR, an extra line for XOR, a bubble for NOT
Lendo um símbolo
- AND tem uma parte traseira plana e frontal arredondada, como um D. OR tem uma parte traseira curva e frontal pontiaguda. XOR é OR com uma linha curva extra sobre suas entradas.
- Um pequeno círculo, a bolha, na saída significa "inverta". AND com bolha é NAND, OR com bolha é NOR.
- NOT é um triângulo com uma bolha: uma entrada, uma saída.

Traseira plana para AND, traseira curva para OR, linha extra para XOR, bolha para NOT
Match each description of a symbol to its gate. · Associe cada descrição de um símbolo à sua porta lógica.
The back of the shape says AND or OR; the extra line says exclusive; the bubble says inverted. · As costas da forma dizem AND ou OR; a linha extra diz exclusivo; a bolinha diz invertido.
Recognising a gate from its output column
- Read the output column from the 00 row down to the 11 row.
- 0 0 0 1 is AND. 0 1 1 1 is OR. 0 1 1 0 is XOR.
- 1 1 1 0 is NAND. 1 0 0 0 is NOR. The inverted gates begin with a 1 where their partner begins with a 0.
Reconhecendo uma porta pela sua coluna de saída
- Leia a coluna de saída da linha 00 até a linha 11.
- 0 0 0 1 é AND. 0 1 1 1 é OR. 0 1 1 0 é XOR.
- 1 1 1 0 é NAND. 1 0 0 0 é NOR. As portas invertidas começam com 1 onde seu parceiro começa com 0.
For inputs A = 0 and B = 1, which gates output 1? Select all · todos that apply. · Para entradas A = 0 e B = 1, quais portas saem 1? Selecione todas as opções aplicáveis.
One input is 1, so OR and XOR give 1; both are not 1, so AND gives 0 and NAND gives 1; both are not 0, so NOR gives 0. · Uma entrada é 1, então OR e XOR dão 1; ambas não são 1, então AND dá 0 e NAND dá 1; ambas não são 0, então NOR dá 0.
Writing the logic expression
- A logic expression 逻辑表达式 writes the gate as words:
X = A AND B,X = A OR B,X = NOT A,X = A NAND B,X = A NOR B,X = A XOR B. - Brackets show which operation happens first when gates are joined:
X = (A AND B) OR C. - The expression, the truth table and the circuit are three views of one function. Next lesson joins the gates into circuits and moves between all three.
Escrevendo a expressão lógica
- Uma expressão lógica 逻辑表达式 escreve a porta usando palavras:
X = A AND B,X = A OR B,X = NOT A,X = A NAND B,X = A NOR B,X = A XOR B. - Parênteses indicam qual operação ocorre primeiro quando as portas são combinadas:
X = (A AND B) OR C. - A expressão, a tabela-verdade e o circuito são três vistas de uma única função. Na próxima aula, conectaremos as portas em circuitos e transitaremos entre as três.
A circuit outputs 1 only when both of its inputs are 1. Which logic expression describes it? · Um circuito sai 1 apenas quando ambas as suas entradas são 1. Qual expressão lógica o descreve?
"Only when both" is the AND definition. NAND is its inverse, OR needs only one input, XOR needs them to differ. · "Apenas quando ambos" é a definição AND. NAND é seu inverso, OR precisa de apenas uma entrada, XOR precisa que elas diferam.
Marks that slip away
- XOR is not OR. For inputs 1 and 1, OR gives 1 and XOR gives 0.
- NAND is NOT (A AND B), not (NOT A) AND B. The bubble is on the output.
- Truth-table rows go 00, 01, 10, 11. A table in another order is marked as wrong even when every row is right.
- A NOT gate has one input. Every other gate in this course has exactly two.
Marcas que escapam
- XOR não é OR. Para entradas 1 e 1, OR dá 1 e XOR dá 0.
- NAND é NOT (A AND B), não (NOT A) AND B. A bolha está na saída.
- As linhas da tabela-verdade vão 00, 01, 10, 11. Uma tabela em outra ordem é marcada como errada mesmo quando todas as linhas estão corretas.
- Uma porta NOT tem uma entrada. Toda outra porta neste curso tem exatamente duas.
You've got it
- a gate does one Boolean operation on inputs of 0 and 1; know each symbol, function and truth table
- AND = both 1 · OR = at least one 1 · NOT = invert · NAND = 0 only when both 1 · NOR = 1 only when both 0 · XOR = inputs differ
- the bubble on a symbol inverts the output; truth tables run 00, 01, 10, 11
- a logic expression writes the same function in words:
X = A NAND B
Entendeu?
- uma porta 执行 uma operação booleana sobre entradas de 0 e 1; conheça cada símbolo, função e tabela-verdade
- AND = ambos 1 · OR = pelo menos um 1 · NOT = inverter · NAND = 0 apenas quando ambos 1 · NOR = 1 apenas quando ambos 0 · XOR = entradas diferentes
- a bolha em um símbolo inverte a saída; tabelas-verdade percorrem 00, 01, 10, 11
- uma expressão lógica escreve a mesma função em palavras:
X = A NAND B