truth tables
题目如下:
In the previous exercises, we used simple logic gates and combinations of several logic gates. These circuits are examples of combinational circuits. Combinational means the outputs of the circuit is a function (in the mathematics sense) of only its inputs. This means that for any given input value, there is only one possible output value. Thus, one way to describe the behaviour of a combinational function is to explicitly list what the output should be for every possible value of the inputs. This is a truth table.
代码如下:
module top_module(
input x3,
input x2,
input x1, // three inputs
output f // one output
);
//always@*begin
//case({x3,x2,x1})
//3'b000,3'b001,3'b100,3'b110:f=0;
//3'b010,3'b011,3'b101,3'b111:f=1;
//endcase
//end
assign f=(x2&!x3)|(x1&x3);
endmodule

浙公网安备 33010602011771号