|
10积分
我刚开始玩FPGA,发现不能直接使用除法,需要使用除法内核(暂时没考虑自己别写除法程序)。
我尝试了IP内核中的Math Functions--dividers, 里面有2个IP核,我都试过了,仿真的时候输出总是高阻状态。
我使用的是Xilinx Spatan3, ISE10.1, Verilog语言,采用自带的ISE Simulator仿真器, 使用编写Verilog Test Fixture的方法仿真。
例如,我利用divider generator V1.0生成my_div模块,并实例化,程序如下:
module div(clk, ce, dividend, divisor, quotient, remainder);
input clk;
input ce;
input [7:0] dividend;
input [7:0] divisor;
output [7:0] quotient;
output [7:0] remainder;
my_div test(
.clk(clk),
.ce(ce),
.aclr(1'b0),
.sclr(1'b0),
.dividend(dividend),
.divisor(divisor),
.quotient(quotient),
.remainder(remainder),
.rfd());
endmodule
然后仿真程序如下:
module test;
// Inputs
reg clk;
reg ce;
reg [7:0] dividend;
reg [7:0] divisor;
// Outputs
wire [7:0] quotient;
wire [7:0] remainder;
// Instantiate the Unit Under Test (UUT)
div uut (
.clk(clk),
.dividend(dividend),
.divisor(divisor),
.quotient(quotient),
.remainder(remainder)
);
initial begin
forever #10 clk = ~clk;
end
initial begin
// Initialize Inputs
clk = 0;
ce = 0;
dividend = 0;
divisor = 0;
// Wait 100 ns for global reset to finish
#100;
dividend = 100;
divisor = 12;
#10;
ce = 1;
#500 $stop;
end
// Add stimulus here
endmodule
但是进入仿真后,quotient与remainder输出总是高电平(见图片),试过好多次了都是这样。
请问大家遇到过这种情况没?
求解原因!谢谢! |
-
|