pa_se_tst.tfw

来自「这是我自己写的4位并转串ISE代码」· TFW 代码 · 共 87 行

TFW
87
字号
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995-2003 Xilinx, Inc.
// All Right Reserved.
////////////////////////////////////////////////////////////////////////////////
//   ____  ____ 
//  /   /\/   / 
// /___/  \  /    Vendor: Xilinx 
// \   \   \/     Version : 8.1i
//  \   \         Application : ISE
//  /   /         Filename : pa_se_tst.tfw
// /___/   /\     Timestamp : Mon Oct 30 09:07:20 2006
// \   \  /  \ 
//  \___\/\___\ 
//
//Command: 
//Design Name: pa_se_tst
//Device: Xilinx
//
`timescale 1ns/1ps

module pa_se_tst;
    reg clk = 1'b0;
    reg [3:0] in = 4'b1101;
    wire out;
    reg clr = 1'b0;

    parameter PERIOD = 200;
    parameter real DUTY_CYCLE = 0.5;
    parameter OFFSET = 0;

    initial    // Clock process for clk
    begin
        #OFFSET;
        forever
        begin
            clk = 1'b0;
            #(PERIOD-(PERIOD*DUTY_CYCLE)) clk = 1'b1;
            #(PERIOD*DUTY_CYCLE);
        end
    end

    pa_se UUT (
        .clk(clk),
        .in(in),
        .out(out),
        .clr(clr));

    integer TX_FILE = 0;
    integer TX_ERROR = 0;
    
    initial begin  // Open the results file...
        TX_FILE = $fopen("results.txt");
        #1200 // Final time:  1200 ns
        if (TX_ERROR == 0) begin
            $display("No errors or warnings.");
            $fdisplay(TX_FILE, "No errors or warnings.");
        end else begin
            $display("%d errors found in simulation.", TX_ERROR);
            $fdisplay(TX_FILE, "%d errors found in simulation.", TX_ERROR);
        end
        $fclose(TX_FILE);
        $stop;
    end

    initial begin
        // -------------  Current Time:  80ns
        #80;
        clr = 1'b1;
        // -------------------------------------
    end

    task CHECK_out;
        input NEXT_out;

        #0 begin
            if (NEXT_out !== out) begin
                $display("Error at time=%dns out=%b, expected=%b", $time, out, NEXT_out);
                $fdisplay(TX_FILE, "Error at time=%dns out=%b, expected=%b", $time, out, NEXT_out);
                $fflush(TX_FILE);
                TX_ERROR = TX_ERROR + 1;
            end
        end
    endtask

endmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?