Line 1... |
Line 1... |
//===========================================================================
|
//===========================================================================
|
// $Id: pci_behaviorial_target.v,v 1.1 2002-02-01 15:07:51 mihad Exp $
|
// $Id: pci_behaviorial_target.v,v 1.2 2002-02-19 16:32:29 mihad Exp $
|
//
|
//
|
// Copyright 2001 Blue Beaver. All Rights Reserved.
|
// Copyright 2001 Blue Beaver. All Rights Reserved.
|
//
|
//
|
// Summary: A PCI Behaviorial Target. This module receives commands over
|
// Summary: A PCI Behaviorial Target. This module receives commands over
|
// the PCI Bus. The PCI Master encodes commands in the middle
|
// the PCI Bus. The PCI Master encodes commands in the middle
|
Line 402... |
Line 402... |
end
|
end
|
end
|
end
|
end
|
end
|
|
|
// Tasks to manage the small SRAM visible in Memory Space
|
// Tasks to manage the small SRAM visible in Memory Space
|
reg [PCI_BUS_DATA_RANGE:0] Test_Device_Mem [0:255]; // address limits, not bits in address
|
reg [PCI_BUS_DATA_RANGE:0] Test_Device_Mem [0:1023]; // address limits, not bits in address
|
// Tasks can't have local storage! have to be module global
|
// Tasks can't have local storage! have to be module global
|
reg [7:0] sram_addr;
|
reg [9:0] sram_addr;
|
task Init_Test_Device_SRAM;
|
task Init_Test_Device_SRAM;
|
begin
|
begin
|
for (sram_addr = 8'h00; sram_addr < 8'hFF; sram_addr = sram_addr + 8'h01)
|
for (sram_addr = 10'h000; sram_addr < 10'h3FF; sram_addr = sram_addr + 10'h001)
|
begin
|
begin
|
Test_Device_Mem[sram_addr] = `BUS_IMPOSSIBLE_VALUE;
|
Test_Device_Mem[sram_addr] = `BUS_IMPOSSIBLE_VALUE;
|
end
|
end
|
|
sram_addr = 10'h3FF; // maximum value must also be written!
|
|
Test_Device_Mem[sram_addr] = `BUS_IMPOSSIBLE_VALUE;
|
end
|
end
|
endtask
|
endtask
|
|
|
task Read_Test_Device_SRAM;
|
task Read_Test_Device_SRAM;
|
input [9:2] sram_address;
|
input [11:2] sram_address;
|
input [PCI_BUS_CBE_RANGE:0] byte_sel ;
|
input [PCI_BUS_CBE_RANGE:0] byte_sel ;
|
output [PCI_BUS_DATA_RANGE:0] target_read_data;
|
output [PCI_BUS_DATA_RANGE:0] target_read_data;
|
reg [PCI_BUS_DATA_RANGE:0] temp_val ;
|
reg [PCI_BUS_DATA_RANGE:0] temp_val ;
|
begin
|
begin
|
temp_val = Test_Device_Mem[sram_address] ;
|
temp_val = Test_Device_Mem[sram_address] ;
|
Line 431... |
Line 433... |
endtask
|
endtask
|
|
|
// Tasks can't have local storage! have to be module global
|
// Tasks can't have local storage! have to be module global
|
reg [PCI_BUS_DATA_RANGE:0] sram_temp;
|
reg [PCI_BUS_DATA_RANGE:0] sram_temp;
|
task Write_Test_Device_SRAM;
|
task Write_Test_Device_SRAM;
|
input [9:2] sram_address;
|
input [11:2] sram_address;
|
input [PCI_BUS_DATA_RANGE:0] master_write_data;
|
input [PCI_BUS_DATA_RANGE:0] master_write_data;
|
input [PCI_BUS_CBE_RANGE:0] master_mask_l;
|
input [PCI_BUS_CBE_RANGE:0] master_mask_l;
|
begin
|
begin
|
sram_temp = Test_Device_Mem[sram_address];
|
sram_temp = Test_Device_Mem[sram_address];
|
sram_temp[7:0] = (~master_mask_l[0]) ? master_write_data[7:0] : sram_temp[7:0];
|
sram_temp[7:0] = (~master_mask_l[0]) ? master_write_data[7:0] : sram_temp[7:0];
|
Line 579... |
Line 581... |
// Store data from PCI bus into SRAM, and increment Write Pointer
|
// Store data from PCI bus into SRAM, and increment Write Pointer
|
task Capture_SRAM_Data_From_AD_Bus;
|
task Capture_SRAM_Data_From_AD_Bus;
|
input [PCI_BUS_DATA_RANGE:0] master_write_data;
|
input [PCI_BUS_DATA_RANGE:0] master_write_data;
|
input [PCI_BUS_CBE_RANGE:0] master_mask_l;
|
input [PCI_BUS_CBE_RANGE:0] master_mask_l;
|
begin
|
begin
|
Write_Test_Device_SRAM (hold_target_address[9:2],
|
Write_Test_Device_SRAM (hold_target_address[11:2],
|
master_write_data[PCI_BUS_DATA_RANGE:0], master_mask_l[PCI_BUS_CBE_RANGE:0]);
|
master_write_data[PCI_BUS_DATA_RANGE:0], master_mask_l[PCI_BUS_CBE_RANGE:0]);
|
hold_target_address[9:2] = hold_target_address[9:2] + 8'h01; // addr++
|
hold_target_address[11:2] = hold_target_address[11:2] + 10'h001; // addr++
|
end
|
end
|
endtask
|
endtask
|
|
|
// Drive SRAM Data onto AD bus, and increment Read Pointer
|
// Drive SRAM Data onto AD bus, and increment Read Pointer
|
task Fetch_SRAM_Data_For_Read_Onto_AD_Bus;
|
task Fetch_SRAM_Data_For_Read_Onto_AD_Bus;
|
output [PCI_BUS_DATA_RANGE:0] target_read_data;
|
output [PCI_BUS_DATA_RANGE:0] target_read_data;
|
begin
|
begin
|
Read_Test_Device_SRAM (hold_target_address[9:2], ~cbe_l_now, target_read_data[PCI_BUS_DATA_RANGE:0]);
|
Read_Test_Device_SRAM (hold_target_address[11:2], ~cbe_l_now, target_read_data[PCI_BUS_DATA_RANGE:0]);
|
hold_target_address[9:2] = hold_target_address[9:2] + 8'h01; // addr++
|
hold_target_address[11:2] = hold_target_address[11:2] + 10'h001; // addr++
|
end
|
end
|
endtask
|
endtask
|
|
|
// The target is able to execute Delayed Reads,
|
// The target is able to execute Delayed Reads,
|
// See the PCI Local Bus Spec Revision 2.2 section 3.3.3.3
|
// See the PCI Local Bus Spec Revision 2.2 section 3.3.3.3
|