Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
S(x, y, z) = Σ(1, 2, 4, 7)
C(x, y, z) = Σ(3, 5, 6, 7 )
4.9 Decoders
• Combinational Logic Implementation (cont.)
– As there are three inputs and a total of eight
minterms, we need a three-to-eight decoder
S(x, y, z) = Σ(1, 2, 4, 7)
C(x, y, z) = Σ(3, 5, 6, 7 )
4.9 Decoders
• Combinational Logic Implementation (cont.)
– A long list of minterms will require an OR gate
with a large number of inputs or several OR gates
cascaded together (large propagation delay)
– A function having k minterms can be expressed in
its complemented form F’ with 2n – k minterms.
• If the number of minterms in the function is greater
than 2n/2, then F’ can be expressed with fewer
minterms
4.10 Encoders
• An encoder performs the inverse operation of
a decoder
– An encoder has 2n (or fewer) inputs and n outputs
– The outputs lines, taken as an aggregate, generate
the desired binary code corresponding to the
input value
4.10 Encoders
• Consider an octal to binary encoder whose truth table is
given below:
bufif1(m_out, A, select);
bufif0(mout_B, select);
endmodule
4.12 HDL Models Of Comb. Circuits
• Dataflow Modeling:
– Bitwise operators perform a bit wise operation on two operands.
• They take each bit in one operand and perform the operation with the
corresponding bit in the other operand.
• If one operand is shorter than the other, it will be extended on the left side
with zeroes to match the length of the longer operand.
– For a logical operation, a vector is tested for equality to 0. If it is, then its Boolean
value is defined as "false", otherwise "true"
• Logical operator evaluation stops as soon as result is known
• Expressions connected by && and || are evaluated from left to right
• The result is a scalar value:
– False if relation is 0
– True if relation is 1
– Unknown (x) if any of the operands has x
– If the operands are scalar, the bitwise and logical will be identical
– Be careful with bitwise versus logical operators:
~(1010) = 01010 but !(1010) = 0
– Reduction bitwise AND useful to check if value is all 1s:
&(1010) = 0, &(1111) = 1
– Reduction bitwise OR useful to check if value is all 0s:
|(1010) = 1, |(0000) = 0
4.12 HDL Models Of Comb. Circuits
module operands();
For a logical operation, a vector is tested for equality to 0.
reg [3:0] A = 4'b1010;
If it is, then its Boolean value is defined as "false", otherwise "true"
reg [3:0] B = 4'b1111;
reg [3:0] C = 4'b0000;
reg [3:0] D = 4'b0101;
initial begin
$display("~A = %4b", ~A);
$display("!A = %4b", !A);
$display("&A = %4b", &A);
$display("A & B = %4b", A&B);
$display("A && B = %4b", A&&B);
$display("A * B = %4b", A*B);
$display("A | B = %4b", A|B);
$display("A || B = %4b", A||B);
$display("A + B = %4b", A+B);
$display("A & C = %4b", A&C);
$display("A && C = %4b", A&&C);
$display("A * C = %4b", A*C);
$display("A | C = %4b", A|C);
$display("A || C = %4b", A||C);
$display("A + C = %4b", A+C);
end
endmodule
4.12 HDL Models Of Comb. Circuits
// Dataflow description of Conditional operator can be used for tri-state buffer modeling.
// two-to-one multiplexer assign data_out = (enable) ? data_reg : 8'bz;
module mux_2x1_df (
output m_out,
input A, B, select
Conditional operator can be nested
); assign out = sel[1] ? (sel[0] ? In3: in2) : (sel[0] ? In1 : in0);