verilog写一个乘法器用数码管显示编译出现错误,请大神帮忙
ERROR:Xst:867 - "MUL.v" line 44: Operator / is only supported when the second operand is a power of 2.源程序如下:用ise编辑器写的。
module MUL(clk,A,B,dataout,en);
input clk;
input A,B;
output dataout;
output en;//位线
reg dataout;//数据输出段线
wire A,B;
reg en;
reg datin;
reg cnt_scan;//扫描频率计数器
reg dataout_buf;
reg baiwei;//百位
reg shiwei;//十位
reg gewei; //个位
always@(A or B)
begin
datin = A*B;
end
always@(datin)
begin
baiwei = datin/(8'd100);
shiwei = (datin%(8'd100))/(8'd10);
gewei = datin%(8'd10);
end
always@(posedge clk )
begin
cnt_scan<=cnt_scan+1;
end
always @(cnt_scan)
begin
case(cnt_scan)
2'b00 :
en = 8'b0111_1111; //百位显示位线
2'b01 :
en = 8'b1011_1111; //十位显示位线
2'b10 :
en = 8'b1101_1111; //个位显示位线
default :
en = 8'b1111_1111;
endcase
end
always@(en) //对应位线给出各段数据
begin
case(en)
8'b0111_1111:
dataout_buf=4'd1;
8'b1011_1111:
dataout_buf=4'd2;
8'b1101_1111:
dataout_buf=4'd3;
default:
dataout_buf=1;
endcase
end
always@(dataout_buf)
begin
case(dataout_buf)
4'd1:
dataout = baiwei;
4'd2:
dataout= shiwei;
4'd3:
dataout= gewei;
default:
dataout = 8'b0000_0000;
endcase
end
endmodule 除法编译器不支持吧! 我也是刚学verilog 帮顶一下 ericw2012 发表于 2013-12-25 22:10
除法编译器不支持吧!
是的,我后来弄明白了,还是谢谢你啊
页:
[1]