weibode01 发表于 2010-11-5 14:47:12

两位数据比较器

两位数据比较器

/* 2bit COMPARATOR*/
module         COMP ( A, B, LG, EQ, SM );
input A, B;
output LG, EQ, SM;
assign         { LG, EQ, SM } = FUNC_COMP ( A, B );

function FUNC_COMP;
input A, B;
if ( A > B )
FUNC_COMP= 3'b100;
else        if ( A < B )
FUNC_COMP= 3'b001;
else
FUNC_COMP= 3'b010;
endfunction

endmodule
页: [1]
查看完整版本: 两位数据比较器