1,、ISE中编写的源代码,为了实现输入两个数据都除4的操作
module cj(
input clk,
input reset,
input wire [23:0] p1,p2,
output reg [23:0] dout
);
always @(posedge clk)
if (reset)
dout <= 0;
else
dout <= (p1>>2)+(p2>>2);
endmodule
2 编写的测试代码
.module test;
// Inputs
reg clk;
reg reset;
reg [23:0] p1;
reg [23:0] p2;
// Outputs
wire [23:0] dout;
// Instantiate the Unit Under Test (UUT)
cj uut (
.clk(clk),
.reset(reset),
.p1(p1),
.p2(p2),
.dout(dout)
);
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
p1 = 0;
p2 = 0;
// Wait 100 ns for global reset to finish
#4 forever clk=!clk;
// Add stimulus her
end
always @(posedge clk)
p1<=p1+4;
在ISE中直接调用modelsim p1,p2,dout 都没数据,不知如何,故向诸位请教下。不胜感激!
endmodule