原创 modelsim功能仿真正确,时序仿真没有输出

2009-10-11 12:52 3162 7 9 分类: FPGA/CPLD

源文件和测试文件如下:请大家给出解决办法


module pipeline_add(a,b,cin,cout,sum,clk);
input[3:0] a,b;
input clk,cin;
output[3:0]sum;
output cout;
reg[3:0] tempa,tempb;
reg tempci;
reg cout;
reg firstco;
reg[1:0] firstsum;
reg[2:0] firsta,firstb;          //??3?fista[2]?¢firstn[2]·?????
reg[3:0] sum;
always@(posedge clk)
   begin
      tempa="a";                 //ê?è?êy?Y?o′?
      tempb="b";
      tempci="cin";
   end
always@(posedge clk)
   begin
  {firstco,firstsum}=tempa[1:0]+tempb[1:0]+tempci;  //μúò????ó£¨μí2??£?
       firsta="tempa"[3:2];                   //?′2??ó????μ?êy?Y?o′?
       firstb="tempb"[3:2];
   end
always@(posedge clk)
   begin
 {cout,sum}={firsta[2:0]+firstb[2:0]+firstco,firstsum}; //μú?t???ó£¨??2??£?
   end
endmodule


`timescale 1ns/1ps
module pipeline_add_test;
    reg [3:0] a = 4'b0000;
    reg [3:0] b = 4'b0000;
    reg cin = 1'b0;
    wire cout;
    wire [3:0] sum;
    reg clk = 1'b0;
    parameter PERIOD = 200;
    parameter real DUTY_CYCLE = 0.5;
    parameter OFFSET = 100;
initial    // Clock process for clk
    begin
        #OFFSET;
        forever
        begin
            clk = 1'b0;
            #(PERIOD-(PERIOD*DUTY_CYCLE)) clk = 1'b1;
            #(PERIOD*DUTY_CYCLE);
        end
    end
    pipeline_add UUT (
        .a(a),
        .b(b),
        .cin(cin),
        .cout(cout),
        .sum(sum),
        .clk(clk));
initial begin
        // -------------  Current Time:  100ns
        #100;
        cin = 1'b1;
        // -------------------------------------
        // -------------  Current Time:  185ns
        #85;
        a = 4'b0010;
        b = 4'b0011;
        // -------------------------------------
        // -------------  Current Time:  385ns
        #200;
        a = 4'b0100;
        b = 4'b0010;
        // -------------------------------------
        // -------------  Current Time:  585ns
        #200;
        cin = 1'b0;
        a = 4'b1010;
        b = 4'b0011;
// -------------------------------------
        // -------------  Current Time:  785ns
        #200;
        a = 4'b1011;
        b = 4'b1010;
        // -------------------------------------
        // -------------  Current Time:  985ns
        #200;
        a = 4'b1111;
        b = 4'b1110;
        // -------------------------------------
        // -------------  Current Time:  1185ns
        #200;
        a = 4'b1101;
        b = 4'b0100;
// -------------------------------------
        // -------------  Current Time:  1585ns
        #400;
        a = 4'b0011;
        // -------------------------------------
        // -------------  Current Time:  1785ns
        #200;
        b = 4'b1101;
        // -------------------------------------
        // -------------  Current Time:  1985ns
        #200;
        cin = 1'b1;
        a = 4'b0101;
        b = 4'b1111;
        // -------------------------------------
        // -------------  Current Time:  2385ns
        #400;
        a = 4'b0100;
        b = 4'b1101;
        // -------------------------------------
    end
endmodule


 

PARTNER CONTENT

文章评论2条评论)

登录后参与讨论

用户1756655 2014-5-8 09:19

很想下载

用户377235 2013-11-10 18:31

good

用户377235 2013-8-30 10:50

学习!

用户104914 2012-10-29 15:54

添加了

用户387732 2012-5-8 11:07

学习啦,强悍!

用户1528895 2011-6-24 10:33

希望可以学习

用户334378 2011-6-6 00:30

怎么下载

用户342159 2011-4-17 14:37

hao !!!!!!!!!

用户411214 2011-3-24 14:37

好强悍.................

用户310116 2010-10-14 23:04

sdafasfd
相关推荐阅读
用户104914 2012-10-29 15:53
modelsim 仿真锁相环,时序仿真没有输出
同样的工程,在进行功能仿真的时候结果正确,在进行时序仿真的时候,没有输出结果。下面提示Note : PLL was reset。不知道是什么个意思...
EE直播间
更多
我要评论
2
7
关闭 站长推荐上一条 /3 下一条