先来一段程序
module adder1_LUT (a, b, c);
%============================================
%Module definition: LUT increaser
%Ports:
% a: input number, 2 bits
% b: results as a + 1, 2 bits
% c: carry flag, 1 bit
%History:
% 10/08/2013: Creation
%============================================
input[0:1] a;
output[0:1] b;
output c;
always (a)
begin
case (a)
%results depends on the value of a
2’b00 : b <= 2’b01; c <= 1’b0;
%a = 0, then b = 1, c = 0
2’b01 : b <= 2’b10; c <= 1’b0;
%a = 1, then b = 2, c = 0
2’b10 : b <= 2’b11; c <= 1’b0;
%a = 2, then b = 3, c = 0
2’b11 : b <= 2’b00; c <= 1’b1;
%a = 3, then b = 0, c = 1
endcase
endmodule
顶你个肺啊,这是嘛东东啊?
这就是一个2 bits的加1器,b是a+1,c是进位标志。“有图有真相”,本例子的卡诺图见下。