
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:19:44 06/21/2010
// Design Name: sell
// Module Name: D:/Xilinx/111/myproject/baidu/testv
// Project Name: baidu
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: sell
//
// Dependencies:
//
// Revision:
// Revision 001 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module test;
// Inputs
reg one_dollar;
reg half_dollar;
reg reset;
reg clk;
// Outputs
wire collect;
wire half_out;
wire dispense;
reg k;
// Instantiate the Unit Under Test (UUT)
sell uut (
one_dollar(one_dollar),
half_dollar(half_dollar),
collect(collect),
half_out(half_out),
dispense(dispense),
reset(reset),
clk(clk)
);
initial begin
// Initialize Inputs
one_dollar = 0;
half_dollar = 0;
reset = 0;
clk = 0;
k=0;
// Wait 100 ns for global reset to finish
#100;
reset=1;
// Add stimulus here
end
always #5 clk=~clk;
always@(posedge clk)
begin
if(reset==0)
begin
one_dollar = 0;
half_dollar = 0;
end
else
begin
if(k==0)
begin
one_dollar=1;
half_dollar=0;
end
else
begin
half_dollar=1;
one_dollar=0;
end
if(collect==1)
begin
k=~k;
end
end
end
endmodule
程序的语法没有问题,但实际上这程序根本无法工作。你把问题简化的太简单了
`timescale 1 ns/ 1 ps
module shift_tb;
reg clk;
reg din;
wire dout;
parameter Period = 10;
shift u1 (
clk(clk),
din(din),
dout(dout)
);
initial
begin
clk = 0;
din = 1'b0; // 初始化输入din
rst = 0; // 低电平复位
#100
rst = 1; // 复位结束
end
always #(Period/2) clk <= ~clk; // clk为10ns
always @(posedge clk)
begin
din <= {$random} % 2; // 产生0和1的随机数,用来做随机输入值
end
endmodule
建立v文件,文件名为 shift_tbv ,这个就是仿真文件。
以上就是关于求verilog编写下面文件的测试信号全部的内容,包括:求verilog编写下面文件的测试信号、verilog问题 为下面的代码 写个测试信号(.vt文件) 用于modelsim仿真 (急用)、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)