112855Sgabeblack@google.com/***************************************************************************** 212855Sgabeblack@google.com 312855Sgabeblack@google.com Licensed to Accellera Systems Initiative Inc. (Accellera) under one or 412855Sgabeblack@google.com more contributor license agreements. See the NOTICE file distributed 512855Sgabeblack@google.com with this work for additional information regarding copyright ownership. 612855Sgabeblack@google.com Accellera licenses this file to you under the Apache License, Version 2.0 712855Sgabeblack@google.com (the "License"); you may not use this file except in compliance with the 812855Sgabeblack@google.com License. You may obtain a copy of the License at 912855Sgabeblack@google.com 1012855Sgabeblack@google.com http://www.apache.org/licenses/LICENSE-2.0 1112855Sgabeblack@google.com 1212855Sgabeblack@google.com Unless required by applicable law or agreed to in writing, software 1312855Sgabeblack@google.com distributed under the License is distributed on an "AS IS" BASIS, 1412855Sgabeblack@google.com WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 1512855Sgabeblack@google.com implied. See the License for the specific language governing 1612855Sgabeblack@google.com permissions and limitations under the License. 1712855Sgabeblack@google.com 1812855Sgabeblack@google.com *****************************************************************************/ 1912855Sgabeblack@google.com 2012855Sgabeblack@google.com/***************************************************************************** 2112855Sgabeblack@google.com 2212855Sgabeblack@google.com io_controller.h -- 2312855Sgabeblack@google.com 2412855Sgabeblack@google.com Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 2512855Sgabeblack@google.com 2612855Sgabeblack@google.com *****************************************************************************/ 2712855Sgabeblack@google.com 2812855Sgabeblack@google.com/***************************************************************************** 2912855Sgabeblack@google.com 3012855Sgabeblack@google.com MODIFICATION LOG - modifiers, enter your name, affiliation, date and 3112855Sgabeblack@google.com changes you are making here. 3212855Sgabeblack@google.com 3312855Sgabeblack@google.com Name, Affiliation, Date: 3412855Sgabeblack@google.com Description of Modification: 3512855Sgabeblack@google.com 3612855Sgabeblack@google.com *****************************************************************************/ 3712855Sgabeblack@google.com 3812855Sgabeblack@google.com/*############################################################################ 3912855Sgabeblack@google.com# Siemens AG copyright 2000 4012855Sgabeblack@google.com# All Rights Reserved 4112855Sgabeblack@google.com# 4212855Sgabeblack@google.com# File name : io_controller.h 4312855Sgabeblack@google.com# 4412855Sgabeblack@google.com# Title : I/O-Controller 4512855Sgabeblack@google.com# 4612855Sgabeblack@google.com# Purpose : definitions for I/O-Controller-module 4712855Sgabeblack@google.com# 4812855Sgabeblack@google.com# Author : Hannes Muhr 4912855Sgabeblack@google.com# PSE EZE MSA 5012855Sgabeblack@google.com# 5112855Sgabeblack@google.com############################################################################## 5212855Sgabeblack@google.com# Modification History : 5312855Sgabeblack@google.com# 5412855Sgabeblack@google.com# 5512855Sgabeblack@google.com##############################################################################*/ 5612855Sgabeblack@google.com 5712855Sgabeblack@google.com#ifndef IO_CONTROLLER_INC 5812855Sgabeblack@google.com#define IO_CONTROLLER_INC 5912855Sgabeblack@google.com 6012855Sgabeblack@google.com#ifdef LOGGING 6112855Sgabeblack@google.com#include <fstream> 6212855Sgabeblack@google.com#endif 6312855Sgabeblack@google.com#include "systemc.h" 6412855Sgabeblack@google.com//#include "mii_if.h" 6512855Sgabeblack@google.com//#include "mbdatm.h" 6612855Sgabeblack@google.com 6712855Sgabeblack@google.com// class semaphore { 6812855Sgabeblack@google.com 6912855Sgabeblack@google.com// bool value; 7012855Sgabeblack@google.com 7112855Sgabeblack@google.com// public: 7212855Sgabeblack@google.com// semaphore(); 7312855Sgabeblack@google.com// void P(); 7412855Sgabeblack@google.com// void V(); 7512855Sgabeblack@google.com// bool get_value(); 7612855Sgabeblack@google.com// }; 7712855Sgabeblack@google.com 7812855Sgabeblack@google.com//void sc_trace(sc_trace_file *, const semaphore&, const std::string&); 7912855Sgabeblack@google.com 8012855Sgabeblack@google.com#ifdef LOGGING 8112855Sgabeblack@google.com/* stream for logging */ 8212855Sgabeblack@google.comextern ofstream flog; 8312855Sgabeblack@google.com#endif 8412855Sgabeblack@google.com 8512855Sgabeblack@google.com#define MII_FIFO_SIZE 400 8612855Sgabeblack@google.com#define SCAN_INTERVAL 200000 // 200 us 8712855Sgabeblack@google.com#define NS *1e-9 8812855Sgabeblack@google.com 8912855Sgabeblack@google.comSC_MODULE(io_controller_m){ 9012855Sgabeblack@google.com 9112855Sgabeblack@google.com /* ports */ 9212855Sgabeblack@google.com sc_in_clk clk_i486_if; 9312855Sgabeblack@google.com 9412855Sgabeblack@google.com sc_out<sc_uint<30> > addr30_o; 9512855Sgabeblack@google.com sc_inout<sc_uint<32> > data32_i; 9612855Sgabeblack@google.com sc_out<sc_uint<32> > data32_o; 9712855Sgabeblack@google.com sc_out<bool> ads_n_o; 9812855Sgabeblack@google.com sc_out<bool> wr_n_o; 9912855Sgabeblack@google.com sc_in<bool> rdy_n_i; 10012855Sgabeblack@google.com sc_in<bool> ar_i; 10112855Sgabeblack@google.com sc_in<bool> res_n_i; 10212855Sgabeblack@google.com 10312855Sgabeblack@google.com sc_out<sc_uint<4> > mii_data4_o; 10412855Sgabeblack@google.com sc_out<bool> mii_en_o; 10512855Sgabeblack@google.com sc_in<sc_uint<4> > mii_data4_i; 10612855Sgabeblack@google.com sc_in<bool> mii_en_i; 10712855Sgabeblack@google.com sc_in<bool> mii_coll_det; 10812855Sgabeblack@google.com sc_in_clk clk_mii; 10912855Sgabeblack@google.com 11012855Sgabeblack@google.com /* signals */ 11112855Sgabeblack@google.com sc_signal<sc_uint<32> > mux_data32; 11212855Sgabeblack@google.com sc_signal<sc_uint<32> > in_fifo_data32; 11312855Sgabeblack@google.com sc_signal<sc_uint<32> > out_fifo_data32; 11412855Sgabeblack@google.com sc_signal<sc_uint<32> > control_data32; 11512855Sgabeblack@google.com sc_signal<bool> out_fifo_en; 11612855Sgabeblack@google.com sc_signal<bool> out_fifo_act; 11712855Sgabeblack@google.com sc_signal<bool> in_fifo_en; 11812855Sgabeblack@google.com sc_signal<bool> control_en; 11912855Sgabeblack@google.com sc_signal<bool> out_fifo_reset; 12012855Sgabeblack@google.com 12112855Sgabeblack@google.com /* variables */ 12212855Sgabeblack@google.com sc_uint<32> addr_tx_frame_ptr; 12312855Sgabeblack@google.com sc_uint<32> rx_ptr_array; 12412855Sgabeblack@google.com sc_signal<bool> value; 12512855Sgabeblack@google.com 12612855Sgabeblack@google.com void P(); 12712855Sgabeblack@google.com void V(); 12812855Sgabeblack@google.com bool get_value(); 12912855Sgabeblack@google.com // semaphore sem; 13012855Sgabeblack@google.com 13112855Sgabeblack@google.com /* modules */ 13212855Sgabeblack@google.com// mux_m *mux; 13312855Sgabeblack@google.com// shifter_m *shifter; 13412855Sgabeblack@google.com// out_fifo_m *out_fifo; 13512855Sgabeblack@google.com// in_fifo_m *in_fifo; 13612855Sgabeblack@google.com 13712855Sgabeblack@google.com SC_CTOR(io_controller_m){ 13812855Sgabeblack@google.com 13912855Sgabeblack@google.com SC_CTHREAD(control_read, clk_i486_if.pos()); 14012855Sgabeblack@google.com 14112855Sgabeblack@google.com// mux = new mux_m("mux"); 14212855Sgabeblack@google.com// mux->clk(clk_mii); 14312855Sgabeblack@google.com// mux->data4_o(mii_data4_o); 14412855Sgabeblack@google.com// mux->data32_i(mux_data32); 14512855Sgabeblack@google.com// mux->en_i(out_fifo_act); 14612855Sgabeblack@google.com// mux->en_o(mii_en_o); 14712855Sgabeblack@google.com 14812855Sgabeblack@google.com// shifter = new shifter_m("shifter"); 14912855Sgabeblack@google.com// shifter->clk(clk_mii); 15012855Sgabeblack@google.com// shifter->data32_o(in_fifo_data32); 15112855Sgabeblack@google.com// shifter->data4_i(mii_data4_i); 15212855Sgabeblack@google.com// shifter->en_i(mii_en_i); 15312855Sgabeblack@google.com// shifter->en_o(in_fifo_en); 15412855Sgabeblack@google.com 15512855Sgabeblack@google.com// out_fifo = new out_fifo_m("out_fifo"); 15612855Sgabeblack@google.com// out_fifo->clk_out(clk_mii); 15712855Sgabeblack@google.com// out_fifo->clk_in(clk_i486_if); 15812855Sgabeblack@google.com// out_fifo->data32_o(mux_data32); 15912855Sgabeblack@google.com// out_fifo->data32_i(out_fifo_data32); 16012855Sgabeblack@google.com// out_fifo->en_i(out_fifo_en); 16112855Sgabeblack@google.com// out_fifo->act_o(out_fifo_act); 16212855Sgabeblack@google.com// out_fifo->reset(out_fifo_reset); 16312855Sgabeblack@google.com 16412855Sgabeblack@google.com// in_fifo = new in_fifo_m("in_fifo"); 16512855Sgabeblack@google.com// in_fifo->clk_out(clk_i486_if); 16612855Sgabeblack@google.com// in_fifo->clk_in(clk_mii); 16712855Sgabeblack@google.com// in_fifo->data32_o(control_data32); 16812855Sgabeblack@google.com// in_fifo->data32_i(in_fifo_data32); 16912855Sgabeblack@google.com// in_fifo->en_i(in_fifo_en); 17012855Sgabeblack@google.com// in_fifo->en_o(control_en); 17112855Sgabeblack@google.com 17212855Sgabeblack@google.com// /* Initialize */ 17312855Sgabeblack@google.com// in_fifo_data32 = (sc_uint<32>) 0; 17412855Sgabeblack@google.com// mux_data32 = (sc_uint<32>) 0; 17512855Sgabeblack@google.com// out_fifo_en = 0; 17612855Sgabeblack@google.com// out_fifo_act = 0; 17712855Sgabeblack@google.com// //en_o = 0; 17812855Sgabeblack@google.com// in_fifo_en = 0; 17912855Sgabeblack@google.com// control_en = 0; 18012855Sgabeblack@google.com// out_fifo_reset = 0; 18112855Sgabeblack@google.com 18212855Sgabeblack@google.com } 18312855Sgabeblack@google.com void control_write(); 18412855Sgabeblack@google.com void control_read(); 18512855Sgabeblack@google.com sc_uint<32> read_from_memory(sc_uint<32>); 18612855Sgabeblack@google.com void write_into_memory(sc_uint<32>, sc_uint<32>); 18712855Sgabeblack@google.com 18812855Sgabeblack@google.com}; 18912855Sgabeblack@google.com 19012855Sgabeblack@google.com#endif 19112855Sgabeblack@google.com 192