|
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 [3:0] A,B;
output[7:0] dataout;
output[7:0] en;//位线
reg[7:0] dataout;//数据输出段线
wire[3:0] A,B;
reg[7:0] en;
reg [7:0] datin;
reg[15:0] cnt_scan;//扫描频率计数器
reg[3:0] dataout_buf;
reg[3:0] baiwei; //百位
reg[3:0] shiwei; //十位
reg[3:0] 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[15:14])
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 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)
|