//
// Copyright Notice and Proprietary Information
//
// Copyright (C) 1992 - 1995 Synopsys, Inc. All rights reserved. This Software
// and manual are owned by Synopsys, Inc., and may be used only as authorized
// in the license agreement controlling such use. No part of this publication
// may be reproduced, transmitted, or translated, in any form or by any means,
// electronic, mechanical, manual, optical, or otherwise, without prior written
// permission of Synopsys, Inc., or as expressly provided by the license agreement.
//
// Destination Control Statement
//
// All technical data contained in this publication is subject to the export
// control laws of the United States of America. Disclosure to nationals of other
// countries contrary to United States law is prohibited. It is the reader's
// responsibility to determine the applicable regulations and to comply with them.
//
// Disclaimer
//
// Synopsys, Inc., makes no warranty of any kind, express or implied, with regard
// to this material, including, but not limited to, the implied warranties of
// merchantability and fitness for a particular purpose.
//
// Synopsys, Inc., reserves the right to make changes without further notice to
// the products described herein. Synopsys, Inc. does not assume any liability
// arising out of the application or use of any product or circuit described
// herein. The Synopsys products described herein are not authorized for use as
// components in life-support devices.
//
`lmv_timescale
module pcislave
(pad,pcxbenn,ppar,pframenn,ptrdynn,pirdynn,pstopnn,pdevselnn,pidsel,psbonn
,psdone,pclk,prstnn,pd,pbenn,ppar64,preq64nn,pack64nn,plocknn,pperrnn,pserrnn);
inout [31:0] pad
;
input [3:0] pcxbenn
;
inout ppar
;
input pframenn
;
inout ptrdynn
;
input pirdynn
;
inout pstopnn
;
output pdevselnn
;
input pidsel
;
input psbonn
;
input psdone
;
input pclk
;
input prstnn
;
inout [63:32] pd
;
input [7:4] pbenn
;
inout ppar64
;
input preq64nn
;
output pack64nn
;
input plocknn
;
output pperrnn
;
output pserrnn
;
parameter gen_debug_level = 0; // debug level: 0 = no debugging
pcislave_fm fm
(pad,pcxbenn,ppar,pframenn,ptrdynn,pirdynn,pstopnn,pdevselnn,pidsel,psbonn
,psdone,pclk,prstnn,pd,pbenn,ppar64,preq64nn,pack64nn,plocknn,pperrnn,pserrnn);
//---------------------------------
//---------------------------------
//-- User variable declarations --
//-- are to be entered here --
//---------------------------------
//---------------------------------
//--**--**--**--**--**--**--**--**-- USER DECLARATION BEGIN
//--**--**--**--**--**--**--**--**-- USER DECLARATION END
// type msg_level_types is
parameter no_msg = 0;
parameter warnings = 1;
parameter debug_1 = 2;
parameter debug_2 = 3;
parameter debug_3 = 4;
parameter debug_cb = 5;
parameter debug_int = 6;
parameter debug_cmd_mem = 7;
//type set_types is :
parameter mpin = 0;
parameter mbus = 1;
parameter mregister = 2;
//type object_name_types is :
parameter pad_bus = 3;
parameter pad_0 = 4;
parameter pad_1 = 5;
parameter pad_2 = 6;
parameter pad_3 = 7;
parameter pad_4 = 8;
parameter pad_5 = 9;
parameter pad_6 = 10;
parameter pad_7 = 11;
parameter pad_8 = 12;
parameter pad_9 = 13;
parameter pad_10 = 14;
parameter pad_11 = 15;
parameter pad_12 = 16;
parameter pad_13 = 17;
parameter pad_14 = 18;
parameter pad_15 = 19;
parameter pad_16 = 20;
parameter pad_17 = 21;
parameter pad_18 = 22;
parameter pad_19 = 23;
parameter pad_20 = 24;
parameter pad_21 = 25;
parameter pad_22 = 26;
parameter pad_23 = 27;
parameter pad_24 = 28;
parameter pad_25 = 29;
parameter pad_26 = 30;
parameter pad_27 = 31;
parameter pad_28 = 32;
parameter pad_29 = 33;
parameter pad_30 = 34;
parameter pad_31 = 35;
parameter pcxbenn_bus = 36;
parameter pcxbenn_0 = 37;
parameter pcxbenn_1 = 38;
parameter pcxbenn_2 = 39;
parameter pcxbenn_3 = 40;
parameter ppar_pin = 41;
parameter pframenn_pin = 42;
parameter ptrdynn_pin = 43;
parameter pirdynn_pin = 44;
parameter pstopnn_pin = 45;
parameter pdevselnn_pin = 46;
parameter pidsel_pin = 47;
parameter psbonn_pin = 48;
parameter psdone_pin = 49;
parameter pclk_pin = 50;
parameter prstnn_pin = 51;
parameter pd_bus = 52;
parameter pd_32 = 53;
parameter pd_33 = 54;
parameter pd_34 = 55;
parameter pd_35 = 56;
parameter pd_36 = 57;
parameter pd_37 = 58;
parameter pd_38 = 59;
parameter pd_39 = 60;
parameter pd_40 = 61;
parameter pd_41 = 62;
parameter pd_42 = 63;
parameter pd_43 = 64;
parameter pd_44 = 65;
parameter pd_45 = 66;
parameter pd_46 = 67;
parameter pd_47 = 68;
parameter pd_48 = 69;
parameter pd_49 = 70;
parameter pd_50 = 71;
parameter pd_51 = 72;
parameter pd_52 = 73;
parameter pd_53 = 74;
parameter pd_54 = 75;
parameter pd_55 = 76;
parameter pd_56 = 77;
parameter pd_57 = 78;
parameter pd_58 = 79;
parameter pd_59 = 80;
parameter pd_60 = 81;
parameter pd_61 = 82;
parameter pd_62 = 83;
parameter pd_63 = 84;
parameter pbenn_bus = 85;
parameter pbenn_4 = 86;
parameter pbenn_5 = 87;
parameter pbenn_6 = 88;
parameter pbenn_7 = 89;
parameter ppar64_pin = 90;
parameter preq64nn_pin = 91;
parameter pack64nn_pin = 92;
parameter plocknn_pin = 93;
parameter pperrnn_pin = 94;
parameter pserrnn_pin = 95;
//type config_types is :
parameter transfer_limit = 96;
parameter abort_limit = 97;
parameter termination_style = 98;
parameter pci_error = 99;
parameter decode = 100;
parameter delays = 101;
parameter dev_id = 102;
parameter ven_id = 103;
parameter rev_id = 104;
parameter h_type = 105;
parameter cls_code = 106;
parameter mem_l_0 = 107;
parameter mem_u_0 = 108;
parameter mem_l_1 = 109;
parameter mem_u_1 = 110;
parameter mem_l_2 = 111;
parameter mem_u_2 = 112;
parameter io_l_0 = 113;
parameter io_u_0 = 114;
parameter io_l_1 = 115;
parameter io_u_1 = 116;
parameter io_l_2 = 117;
parameter io_u_2 = 118;
parameter c_line_size = 119;
parameter addr_64 = 120;
parameter data_64 = 121;
parameter int_ack = 122;
parameter int_ack_vector = 123;
//type mem_types is :
parameter mem = 124;
parameter io = 125;
parameter cfg = 126;
parameter all_delays = -1; // For configure_delay(all_delays,0);
reg init
; initial init
= `true;
reg first
; initial first
= `true;
//integer msg_level ; initial msg_level = `warnings;
integer msg_level
; initial msg_level
= gen_debug_level;
reg valid_f
; initial valid_f
= `false;
task vfy_rdy;
begin
if (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
end // if
end
endtask // vfy_rdy
task configure;
input [31 : 0] ctype;
input [64:1] generic_value;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v configure");
end // if
vfy_rdy;
fm.timing.configure(ctype, generic_value);
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // configure
task configure_delay;
input [31 : 0] delay_index;
input [31 : 0] delay;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v configure");
end // if
vfy_rdy;
fm.timing.configure_delay(delay_index , delay );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // configure_delay
task request;
input [31 : 0] request_limit;
input [31 : 0] decode;
input [31 : 0] delay;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v request");
end // if
vfy_rdy;
fm.timing.request(request_limit , decode , delay );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // request
task idle;
input [31 : 0] cycles;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v idle");
end // if
vfy_rdy;
fm.timing.idle(cycles );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // idle
task trigger;
input [31 : 0] tvalue;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v trigger");
end // if
vfy_rdy;
fm.timing.trigger(tvalue );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // trigger
task wait_on;
input [31 : 0] tvalue;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v wait_on");
end // if
vfy_rdy;
fm.timing.wait_on(tvalue );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // wait_on
task print_msg;
input [1 : `token_size*8] message;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v print_msg");
end // if
vfy_rdy;
fm.timing.print_msg(message );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // print_msg
task set_msg_level;
input [31 : 0] mlevel; // enum type msg_level_types
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v set_msg_level");
end // if
vfy_rdy;
msg_level = mlevel;
fm.timing.set_msg_level(mlevel );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
end
endtask // set_msg_level
task call;
input [1 : `token_size*8] function_name;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v call");
end // if
vfy_rdy;
fm.timing.call(function_name );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // call
task func_beg;
input [1 : `token_size*8] function_name;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v func_beg");
end // if
vfy_rdy;
fm.timing.func_beg(function_name );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // func_beg
task func_end;
input [1 : `token_size*8] function_name;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v func_end");
end // if
vfy_rdy;
fm.timing.func_end(function_name );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // func_end
task sequential;
begin
if (!((msg_level < `debug_3))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"pcislave.v sequential");
$display("\"");
end // if
vfy_rdy;
fm.timing.sequential;
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin @(fm.fm_rsp.strobe); end
check_int;
end
endtask // sequential
task stop_sim;
begin
if (!((msg_level < `debug_3))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"pcislave.v stop_sim");
$display("\"");
end // if
vfy_rdy;
fm.timing.stop_sim;
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin @(fm.fm_rsp.strobe); end
check_int;
end
endtask // stop_sim
task wait_on_node;
input [1:`token_size*8] node_name;
input [1:`token_size] node_value;
input [1:`token_size] node_mask;
begin
if (!((msg_level < `debug_3))) begin
$display("NOTE at %0t from %m", $time);
$write(" \"pcislave.v wait_on_node");
$display("\"");
end // if
vfy_rdy;
fm.timing.wait_on_node(node_name,node_value,node_mask);
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin @(fm.fm_rsp.strobe); end
check_int;
end
endtask // wait_on_node
task open_buffer;
input [1 : `token_size*8] function_name;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v open_buffer");
end // if
vfy_rdy;
fm.timing.open_buffer(function_name );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // open_buffer
task close_buffer;
input [1 : `token_size*8] function_name;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v close_buffer");
end // if
vfy_rdy;
fm.timing.close_buffer(function_name );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // close_buffer
task set;
input [31 : 0] stype; // enum type set_types
input [31 : 0] object_name; // enum type object_name_types
input [`slv_size-1 : 0] object_value;
input [31 : 0] delay_val;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v set");
end // if
vfy_rdy;
fm.timing.set(stype , object_name , object_value , delay_val );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // set
task set_addr;
input [31 : 0] mtype; // enum type mem_types
input [`slv_size-1 : 0] saddr;
input [`slv_size-1 : 0] object_value;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v set_addr");
end // if
vfy_rdy;
fm.timing.set_addr(mtype , saddr , object_value );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // set_addr
task get;
input [31 : 0] stype; // enum type set_types
input [31 : 0] object_name; // enum type object_name_types
input [`slv_size-1 : 0] expected_data;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v get");
end // if
vfy_rdy;
fm.timing.get(stype , object_name , expected_data );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // get
task get_addr;
input [31 : 0] mtype; // enum type mem_types
input [`slv_size-1 : 0] saddr;
input [`slv_size-1 : 0] expected_data;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v get_addr");
end // if
vfy_rdy;
fm.timing.get_addr(mtype , saddr , expected_data );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // get_addr
task reload;
input [31 : 0] mtype; // enum type mem_types
input [1 : `token_size*8] dfile;
input flush_f;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v reload");
end // if
vfy_rdy;
fm.timing.reload(mtype , dfile , flush_f );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // reload
task dump;
input [31 : 0] mtype; // enum type mem_types
input [`slv_size-1 : 0] start_addr;
input [`slv_size-1 : 0] end_addr;
input [1 : `token_size*8] dfile;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v dump");
end // if
vfy_rdy;
fm.timing.dump(mtype , start_addr , end_addr , dfile );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // dump
task remote;
input [31 : 0] target_id; // enum type natural
input [1 : `token_size*8] msg;
input buffer_f;
input notify_f;
input return_data_f;
begin
if (msg_level >= `debug_3) begin
$display("NOTE at %0t from %m", $time);
$display(" pcislave.v remote");
end // if
vfy_rdy;
fm.timing.remote(target_id , msg , buffer_f , notify_f , return_data_f );
fm.fm_cmd <= #(0) fm.timing.wk_cmd;
@(fm.fm_rsp.strobe); while (!(fm.fm_rsp.ready)) begin
@(fm.fm_rsp.strobe); end
check_int;
end
endtask // remote
task check_int;
begin
if (msg_level >= `debug_3) begin
$display("check_int : enter");
end //if
end
endtask // check_int
//----------------------------------
//----------------------------------
//-- This block terminates the --
//-- code which will be replaced --
//-- by VGEN on future reruns --
//-- Enter USER code only after --
//-- this comment block --
//----------------------------------
//--**--**--**--**--**--**--**--**--
`define RANDOM_LMC_SLAVE
`ifdef RANDOM_LMC_SLAVE
integer pci_seed
;
integer index
;
integer ranval
;
`endif
always begin : model
if ( init ) begin
init = `false;
end else begin
//-------------------------------
//-------------------------------
// User model code goes here ----
// replacing the following wait -
//-------------------------------
//-------------------------------
//-----------------------------------------------------------------------------
// Bus control commands are inserted between the following comment lines.
// Any commands include in this section are provide as part of the LMG
// delivered test bench and as examples. These commands may be modified
// or deleted. Note, a single call("<subroutine>") command is all that is
// required to executed commands from an external command file referenced by
// the parameter/generic cmd_file.
// Once the called <subroutine> completes command execution switches back to
// the embedded mode. Thus, command sequences may include commands from an
// external command file and embedded commands. Multiple "call" commands may
// be executed.
//
//-----------------------------------------------------------------------------
// ==== EMBEDDED COMMANDS BEGIN ==== --
`ifdef RANDOM_LMC_SLAVE
$GetEnv("pci_seed", pci_seed) ;
if (pci_seed == 0)
begin
/*
* Seed is 0, no random delays
*/
$display("%d :: pcislave : static delays selected", $time) ;
call("main") ;
end
else
begin
/*
* Seed is non-0, program random delays on every FRAME
*/
$display("%d :: pcislave : random delays selected : seed %d", $time, pci_seed) ;
while (1)
begin
/*
* Wait for next transaction, then randomly program slave
*
* Note that the programming does not take effect until
* the following transaction (don't know why and don't have
* time to trace it).
*
* Note also the fancy footwork after waiting for the negedge
* of frame. This is required because there is a zero time
* st1->st0->pu1 glitch at frame deassert. Need to make sure
* that frame *really* is asserted.
*/
repeat (1) @(negedge pframenn) ;
#1 ;
if ( pframenn === 0 )
begin
ranval = $dist_uniform(pci_seed, 0, 3) ;
//$display("%d :: pcislave : configure(transfer_limit, %0d)", $time, ranval) ;
configure(transfer_limit, ranval) ;
ranval = $dist_uniform(pci_seed, 0, 1) ;
//$display("%d :: pcislave : configure(termination_style, %0d)", $time, ranval) ;
configure(termination_style, ranval) ;
for (index = 1; index <= 8; index = index + 1)
begin
ranval = $dist_uniform(pci_seed, 0, 15) ;
//$display("%d :: pcislave : configure_delay(%0d, %0d)", $time, index, ranval) ;
configure_delay(index, ranval) ;
end
end
end
end
`else
call("main"); // comment out to execute embedded commands.
`endif
// ==== EMBEDDED COMMANDS END ==== --
// The "wait" statement below should not be removed except to execute old commands.
wait (`false); // wait forever
end // if
end //;
//always @(pframenn)
// $display("%d :: pcislave : pframenn %v", $time, pframenn) ;
endmodule // behav;
This page: |
Created: | Thu Aug 19 11:59:22 1999 |
| From: |
../../../sparc_v8/system/lmc/rtl/pcislave.v
|