Download presentation
Presentation is loading. Please wait.
Published byAllison Cook Modified over 9 years ago
1
Engineering 100 Section 250 Combinational Logic -- Examples 9/13/2010
2
Truth table ABCOut 000 001 010 011 100 101 110 111
3
Truth table ABCOut 000 001 010 011 100 101 110 111
4
NOT module NOT( input wire A, output reg B); always @* begin if (A == 1'b0) begin B = 1'b1; end else begin B = 1'b0; end endmodule
5
module RR_raise10( input wire OSU, input wire Bowl, output reg raise1, output reg raise0); always @* begin raise1 = 1'b0; raise0 = 1'b0; if (OSU == 1'b0 && Bowl == 1'b1) begin raise1 = 1'b0; raise0 = 1'b1; end else if (OSU == 1'b1 && Bowl == 1'b0) begin raise1 = 1'b0; raise0 = 1'b1; end else if (OSU == 1'b1 && Bowl == 1'b1) begin raise1 = 1'b1; raise0 = 1'b1; end endmodule
6
module add( input wire [1:0] A, input wire [1:0] B, output reg [2:0] C); always @* begin C[2:0] = A[1:0] + B[1:0]; end endmodule Add
7
Bad Add module add( input wire [1:0] A, input wire [1:0] B, output reg [1:0] C); always @* begin if ( A == 2'b00 && B == 2'b00) begin C = 3'b000; end else if ( A == 2'b00 && B == 2'b01) begin C = 3'b001;... end else if ( A == 2'b11 && B == 2'b10) begin C = 3'b101; end else begin C = 3'b110; end endmodule
8
Truth table ABC 000 001 010 011 100 101 110 111
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.