⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pci_mast.tf

📁 VHDLVERILOG语言实现的CARDBUS的IP源码,已经实现现场应用
💻 TF
📖 第 1 页 / 共 3 页
字号:
        //$display ("     COMPARE SAYS:");
        //$display ("     addr = %0h at %0t", addr, $time);        
        //$display ("     actual = %0h at %0t", actual, $time);
        //$display ("     expected = %0h at %0t", expected, $time);        
        //$display ("     be = %0h", be);
        //$display ("     be_mask = %0h", be_mask);
        if (be_mask != 0) begin
                if (addr[2])
                        last_data = {actual & be_mask, 32'h00000000};
                else    last_data = {32'h00000000, actual & be_mask};
        end

end
endtask

// Exact same as target_access_pf but passes back last data

/*
task target_access_pf_get_data(address, data, command, be, addr_parity,
                   data_parity, dword_count, initial_data_delay,
                   next_data_delay, m64bit, pass_fail, quiet, last_data);
*/
task target_access_pf_get_data;

input [63:0] address;
input [63:0] data;
input [3:0] command;
input [7:0] be;
input addr_parity;
input data_parity;
input [31:0] dword_count;
input [3:0] initial_data_delay;
input [3:0] next_data_delay;
input m64bit;
inout pass_fail;
input quiet;
output [63:0] last_data;

reg [RW_BUFF_SIZE_ADDR_BITS:0] array_position;
reg pass_fail;
reg m64_local;

begin

    pass_fail = 1'b1; // we pass unless something doesn't compare and sets this to 0
    
    if ( dword_count < 1 ) begin
       $display("Error: time=%d, target_access requested with a transfer count of 0",$time);
       repeat (10) @(posedge pci_clk);
       $finish;
    end

    if (force_32) m64_local = 1'b0;
    else m64_local = m64bit;

    if (dword_count <= 2) begin
      data_array[0] = data[31:0];
      data_array[1] = data[63:32];
      be_array[0] = be[3:0];
      be_array[1] = be[7:4];
    end

	got_devsel = 1'b1;
	array_position = 0;
	while (got_devsel & (dword_count>0) ) begin
		dwords_transmitted = 0;
		target_access_one_frame(address, data, command, be, addr_parity,
			data_parity, dword_count, initial_data_delay,
			next_data_delay, m64_local & (address[2:0]==0) & (dword_count[0]==0), array_position,
			pass_fail, quiet, last_data, 1'b0);
		//$display("Transmitted %d dwords",dwords_transmitted);
		array_position = array_position + dwords_transmitted;
		address = address + dwords_transmitted*4;
		dword_count = dword_count - dwords_transmitted;
		//$display("%d dwords left to go",dword_count);
	end

        //$display ("address=%0h data=%0h command=%0h be=%0h addr_parity=%0h data_parity=%0h dword_count=%0h m64bit=%0b", address, data, command, be, addr_parity, data_parity, dword_count, m64_local);
        //$display ("data returned=%0h", last_data);

end
endtask

// Exact same as target_access_pf but checks burst size
// for minimum

/*
task target_access_pf_check_burst_size(address, data, command, be, addr_parity,
                   data_parity, dword_count, initial_data_delay,
                   next_data_delay, m64bit, pass_fail, quiet, min_burst_size);
*/
task target_access_pf_check_burst_size;

input [63:0] address;
input [63:0] data;
input [3:0] command;
input [7:0] be;
input addr_parity;
input data_parity;
input [31:0] dword_count;
input [3:0] initial_data_delay;
input [3:0] next_data_delay;
input m64bit;
inout pass_fail;
input quiet;
input min_burst_size;
integer min_burst_size;

reg [RW_BUFF_SIZE_ADDR_BITS:0] array_position;
reg pass_fail;
reg m64_local;

reg [63:0] temp;

begin

    pass_fail = 1'b1; // we pass unless something doesn't compare and sets this to 0
    
    if ( dword_count < 1 ) begin
       $display("Error: time=%d, target_access requested with a transfer count of 0",$time);
       repeat (10) @(posedge pci_clk);
       $finish;
    end

    if (dword_count <= 2) begin
      data_array[0] = data[31:0];
      data_array[1] = data[63:32];
      be_array[0] = be[3:0];
      be_array[1] = be[7:4];
    end

    if (force_32) m64_local = 1'b0;
    else m64_local = m64bit;

	got_devsel = 1'b1;
	array_position = 0;
	while (got_devsel & (dword_count>0) ) begin
		dwords_transmitted = 0;
		target_access_one_frame(address, data, command, be, addr_parity,
			data_parity, dword_count, initial_data_delay,
			next_data_delay, m64_local & (address[2:0]==0) & (dword_count[0]==0), array_position,
			pass_fail, quiet, temp, 1'b0);
		//$display("Transmitted %d dwords at %0t",dwords_transmitted, $time);
		
        	array_position = array_position + dwords_transmitted;
		address = address + dwords_transmitted*4;
		dword_count = dword_count - dwords_transmitted;
		//$display("%d dwords left to go %0t",dword_count, $time);
	end
end

endtask


// Exact same as target_access but accepts pass_fail and quiet

/*
task target_access_pf(address, data, command, be, addr_parity,
                   data_parity, dword_count, initial_data_delay,
                   next_data_delay, m64bit, pass_fail, quiet);
*/
task target_access_pf;

input [63:0] address;
input [63:0] data;
input [3:0] command;
input [7:0] be;
input addr_parity;
input data_parity;
input [31:0] dword_count;
input [3:0] initial_data_delay;
input [3:0] next_data_delay;
input m64bit;
inout pass_fail;
input quiet;

reg [RW_BUFF_SIZE_ADDR_BITS:0] array_position;
reg pass_fail;
reg m64_local;

reg [63:0] temp;

begin

    pass_fail = 1'b1; // we pass unless something doesn't compare and sets this to 0
    
    if ( dword_count < 1 ) begin
       $display("Error: time=%d, target_access requested with a transfer count of 0",$time);
       repeat (10) @(posedge pci_clk);
       $finish;
    end

    if (dword_count <= 2) begin
      data_array[0] = data[31:0];
      data_array[1] = data[63:32];
      be_array[0] = be[3:0];
      be_array[1] = be[7:4];
    end

    if (force_32) m64_local = 1'b0;
    else m64_local = m64bit;

	got_devsel = 1'b1;
	array_position = 0;
	while (got_devsel & (dword_count>0) ) begin
		dwords_transmitted = 0;
		target_access_one_frame(address, data, command, be, addr_parity,
			data_parity, dword_count, initial_data_delay,
			next_data_delay, m64_local & (address[2:0]==0) & (dword_count[0]==0), array_position,
			pass_fail, quiet, temp, 1'b0);
		//$display("Transmitted %d dwords at %0t",dwords_transmitted, $time);
		array_position = array_position + dwords_transmitted;
		address = address + dwords_transmitted*4;
		dword_count = dword_count - dwords_transmitted;
		//$display("%d dwords left to go %0t",dword_count, $time);
	end
end

endtask

// Exact same as target_access but accepts hold_req for fast back-to-back testing

/*
task target_access_hold_req(address, data, command, be, addr_parity,
                   data_parity, dword_count, initial_data_delay,
                   next_data_delay, m64bit, hold_req);
*/
task target_access_hold_req;

input [63:0] address;
input [63:0] data;
input [3:0] command;
input [7:0] be;
input addr_parity;
input data_parity;
input [31:0] dword_count;
input [3:0] initial_data_delay;
input [3:0] next_data_delay;
input m64bit;
input hold_req;

reg [RW_BUFF_SIZE_ADDR_BITS:0] array_position;
reg pass_fail;
reg m64_local;

reg [63:0] temp;

begin
    pass_fail = 1'b1; // we pass unless something doesn't compare and sets this to 0
    if ( dword_count < 1 ) begin
       $display("Error: time=%d, target_access requested with a transfer count of 0",$time);
       repeat (10) @(posedge pci_clk);
       $finish;
    end

    if (dword_count <= 2) begin
      data_array[0] = data[31:0];
      data_array[1] = data[63:32];
      be_array[0] = be[3:0];
      be_array[1] = be[7:4];
	end

    if (force_32) m64_local = 1'b0;
    else m64_local = m64bit;

	got_devsel = 1'b1;
	array_position = 0;
	while (got_devsel & (dword_count>0) ) begin
		dwords_transmitted = 0;
		target_access_one_frame(address, data, command, be, addr_parity,
			data_parity, dword_count, initial_data_delay,
			next_data_delay, m64_local & (address[2:0]==0) & (dword_count[0]==0), array_position,
			pass_fail, 1'b1, temp, hold_req);

		//$display("Transmitted %d dwords before %0t",dwords_transmitted, $time);
		array_position = array_position + dwords_transmitted;
		address = address + dwords_transmitted*4;
		dword_count = dword_count - dwords_transmitted;
		//$display("%d dwords left to go before %0t",dword_count, $time);
	end
end
endtask

// Exact same as target_access_pf but checks burst size
// for minimum

/*
task target_access_check_burst_size(address, data, command, be, addr_parity,
                   data_parity, dword_count, initial_data_delay,
                   next_data_delay, m64bit, min_burst_size);
*/
task target_access_check_burst_size;

input [63:0] address;
input [63:0] data;
input [3:0] command;
input [7:0] be;
input addr_parity;
input data_parity;
input [31:0] dword_count;
input [3:0] initial_data_delay;
input [3:0] next_data_delay;
input m64bit;
input min_burst_size;
integer min_burst_size;

reg [RW_BUFF_SIZE_ADDR_BITS:0] array_position;
reg pass_fail;
reg m64_local;

reg [63:0] temp;

begin
    pass_fail = 1'b1; // we pass unless something doesn't compare and sets this to 0
    if ( dword_count < 1 ) begin
       $display("Error: time=%d, target_access requested with a transfer count of 0",$time);
       repeat (10) @(posedge pci_clk);
       $finish;
    end

    if (dword_count <= 2) begin
      data_array[0] = data[31:0];
      data_array[1] = data[63:32];
      be_array[0] = be[3:0];
      be_array[1] = be[7:4];
	end

    if (force_32) m64_local = 1'b0;
    else m64_local = m64bit;

	got_devsel = 1'b1;
	array_position = 0;
	while (got_devsel & (dword_count>0) ) begin
		dwords_transmitted = 0;
		target_access_one_frame(address, data, command, be, addr_parity,
			data_parity, dword_count, initial_data_delay,
			next_data_delay, m64_local & (address[2:0]==0) & (dword_count[0]==0), array_position,
			pass_fail, 1'b1, temp, 1'b0);
		//$display("Transmitted %d dwords before %0t",dwords_transmitted, $time);

		array_position = array_position + dwords_transmitted;
		address = address + dwords_transmitted*4;
		dword_count = dword_count - dwords_transmitted;
		//$display("%d dwords left to go before %0t",dword_count, $time);
	end
end
endtask


/*
task target_access_one_piece(address, data, command, be, addr_parity,
                   data_parity, dword_count, initial_data_delay,
                   next_data_delay, m64bit);
*/
task target_access_one_piece;
input [63:0] address;
input [63:0] data;
input [3:0] command;
input [7:0] be;
input addr_parity;
input data_parity;
input [31:0] dword_count;
input [3:0] initial_data_delay;
input [3:0] next_data_delay;
input m64bit;

reg [RW_BUFF_SIZE_ADDR_BITS:0] array_position;
reg pass_fail;
reg m64_local;

reg [63:0] temp;

begin
    pass_fail = 1'b1; // we pass unless something doesn't compare and sets this to 0
    if ( dword_count < 1 ) begin
       $display("Error: time=%d, target_access requested with a transfer count of 0",$time);
       repeat (10) @(posedge pci_clk);
       $finish;
    end

⌨️ 快捷键说明

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