📄 pci_target32_sm.v
字号:
//////////////////////////////////////////////////////////////////////
//// ////
//// File name: pci_target32_sm.v ////
//// ////
//// This file is part of the "PCI bridge" project ////
//// http://www.opencores.org/cores/pci/ ////
//// ////
//// Author(s): ////
//// - Tadej Markovic, tadej@opencores.org ////
//// ////
//// All additional information is avaliable in the README.txt ////
//// file. ////
//// ////
//// ////
//////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000 Tadej Markovic, tadej@opencores.org ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer. ////
//// ////
//// This source file is free software; you can redistribute it ////
//// and/or modify it under the terms of the GNU Lesser General ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any ////
//// later version. ////
//// ////
//// This source is distributed in the hope that it will be ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
//// PURPOSE. See the GNU Lesser General Public License for more ////
//// details. ////
//// ////
//// You should have received a copy of the GNU Lesser General ////
//// Public License along with this source; if not, download it ////
//// from http://www.opencores.org/lgpl.shtml ////
//// ////
//////////////////////////////////////////////////////////////////////
//
// CVS Revision History
//
// $Log: pci_target32_sm.v,v $
// Revision 1.11 2003/12/19 11:11:30 mihad
// Compact PCI Hot Swap support added.
// New testcases added.
// Specification updated.
// Test application changed to support WB B3 cycles.
//
// Revision 1.10 2003/08/08 16:36:33 tadejm
// Added 'three_left_out' to pci_pciw_fifo signaling three locations before full. Added comparison between current registered cbe and next unregistered cbe to signal wb_master whether it is allowed to performe burst or not. Due to this, I needed 'three_left_out' so that writing to pci_pciw_fifo can be registered, otherwise timing problems would occure.
//
// Revision 1.9 2003/01/27 16:49:31 mihad
// Changed module and file names. Updated scripts accordingly. FIFO synchronizations changed.
//
// Revision 1.8 2003/01/21 16:06:56 mihad
// Bug fixes, testcases added.
//
// Revision 1.7 2002/09/24 19:09:17 mihad
// Number of state bits define was removed
//
// Revision 1.6 2002/09/24 18:30:00 mihad
// Changed state machine encoding to true one-hot
//
// Revision 1.5 2002/08/22 09:07:06 mihad
// Fixed a bug and provided testcase for it. Target was responding to configuration cycle type 1 transactions.
//
// Revision 1.4 2002/02/19 16:32:37 mihad
// Modified testbench and fixed some bugs
//
// Revision 1.3 2002/02/01 15:25:12 mihad
// Repaired a few bugs, updated specification, added test bench files and design document
//
// Revision 1.2 2001/10/05 08:14:30 mihad
// Updated all files with inclusion of timescale file for simulation purposes.
//
// Revision 1.1.1.1 2001/10/02 15:33:47 mihad
// New project directory structure
//
//
`include "pci_constants.v"
// synopsys translate_off
`include "timescale.v"
// synopsys translate_on
module pci_target32_sm
(
// system inputs
clk_in,
reset_in,
// master inputs
pci_frame_in,
pci_irdy_in,
pci_idsel_in,
pci_frame_reg_in,
pci_irdy_reg_in,
pci_idsel_reg_in,
// target response outputs
pci_trdy_out,
pci_stop_out,
pci_devsel_out,
pci_trdy_en_out,
pci_stop_en_out,
pci_devsel_en_out,
ad_load_out,
ad_load_on_transfer_out,
// address, data, bus command, byte enable in/outs
pci_ad_reg_in,
pci_ad_out,
pci_ad_en_out,
pci_cbe_reg_in,
pci_cbe_in,
bckp_trdy_en_in,
bckp_devsel_in,
bckp_trdy_in,
bckp_stop_in,
pci_trdy_reg_in,
pci_stop_reg_in,
// backend side of state machine with control signals to pci_io_mux ...
address_out,
addr_claim_in,
bc_out,
bc0_out,
data_out,
data_in,
be_out,
next_be_out,
req_out,
rdy_out,
addr_phase_out,
bckp_devsel_out,
bckp_trdy_out,
bckp_stop_out,
last_reg_out,
frame_reg_out,
fetch_pcir_fifo_out,
load_medium_reg_out,
sel_fifo_mreg_out,
sel_conf_fifo_out,
load_to_pciw_fifo_out,
load_to_conf_out,
same_read_in,
norm_access_to_config_in,
read_completed_in,
read_processing_in,
target_abort_in,
disconect_wo_data_in,
disconect_w_data_in,
target_abort_set_out,
pciw_fifo_full_in,
pcir_fifo_data_err_in,
wbw_fifo_empty_in,
wbu_del_read_comp_pending_in,
wbu_frame_en_in
) ;
/*----------------------------------------------------------------------------------------------------------------------
Various parameters needed for state machine and other stuff
----------------------------------------------------------------------------------------------------------------------*/
parameter S_IDLE = 3'b001 ;
parameter S_WAIT = 3'b010 ;
parameter S_TRANSFERE = 3'b100 ;
/*==================================================================================================================
System inputs.
==================================================================================================================*/
// PCI side clock and reset
input clk_in,
reset_in ;
/*==================================================================================================================
PCI interface signals - bidirectional signals are divided to inputs and outputs in I/O cells instantiation
module. Enables are separate signals.
==================================================================================================================*/
// master inputs
input pci_frame_in,
pci_irdy_in,
pci_idsel_in ;
input pci_frame_reg_in,
pci_irdy_reg_in,
pci_idsel_reg_in ;
// target response outputs
output pci_trdy_out,
pci_stop_out,
pci_devsel_out ;
output pci_trdy_en_out,
pci_stop_en_out,
pci_devsel_en_out ;
output ad_load_out ;
output ad_load_on_transfer_out ;
// address, data, bus command, byte enable in/outs
input [31:0] pci_ad_reg_in ;
output [31:0] pci_ad_out ;
output pci_ad_en_out ;
input [3:0] pci_cbe_reg_in ;
input [3:0] pci_cbe_in ;
input bckp_trdy_en_in ;
input bckp_devsel_in ;
input bckp_trdy_in ;
input bckp_stop_in ;
input pci_trdy_reg_in ;
input pci_stop_reg_in ;
/*==================================================================================================================
Other side of PCI Target state machine
==================================================================================================================*/
// Data, byte enables, bus commands and address ports
output [31:0] address_out ; // current request address output - registered
input addr_claim_in ; // current request address claim input
output [3:0] bc_out ; // current request bus command output - registered
output bc0_out ; // current cycle RW signal output
input [31:0] data_in ; // for read operations - current dataphase data input
output [31:0] data_out ; // for write operations - current request data output - registered
output [3:0] be_out ; // current dataphase byte enable outputs - registered
output [3:0] next_be_out ; // next dataphase byte enable outputs - NOT registered
// Port connection control signals from PCI FSM
output req_out ; // Read is requested to WB master
output rdy_out ; // DATA / ADDRESS selection when read or write - registered
output addr_phase_out ; // Indicates address phase and also fast-back-to-back address phase - registered
output bckp_devsel_out ; // DEVSEL output (which is registered) equivalent
output bckp_trdy_out ; // TRDY output (which is registered) equivalent
output bckp_stop_out ; // STOP output (which is registered) equivalent
output last_reg_out ; // Indicates last data phase - registered
output frame_reg_out ; // FRAME output signal - registered
output fetch_pcir_fifo_out ;// Read enable for PCIR_FIFO when when read is finishen on WB side
output load_medium_reg_out ;// Load data from PCIR_FIFO to medium register (first data must be prepared on time)
output sel_fifo_mreg_out ; // Read data selection between PCIR_FIFO and medium register
output sel_conf_fifo_out ; // Read data selection between Configuration registers and "FIFO"
output load_to_pciw_fifo_out ;// Write enable to PCIW_FIFO
output load_to_conf_out ; // Write enable to Configuration space registers
/*==================================================================================================================
Status
==================================================================================================================*/
input same_read_in ; // Indicates the same read request (important when read is finished on WB side)
input norm_access_to_config_in ; // Indicates the access to Configuration space with MEMORY commands
input read_completed_in ; // Indicates that read request is completed on WB side
input read_processing_in ; // Indicates that read request is processing on WB side
input target_abort_in ; // Indicates target abort termination
input disconect_wo_data_in ; // Indicates disconnect without data termination
input disconect_w_data_in ; // Indicates disconnect with data termination
input pciw_fifo_full_in ; // Indicates that write PCIW_FIFO is full
input pcir_fifo_data_err_in ; // Indicates data error on current data read from PCIR_FIFO
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -