Mercurial > pygar
diff modules/bluespec/Pygar/core/Processor.bsv @ 11:50af57801d6e pygar svn.12
[svn r12] working on getting audio pipe processor working
author | punk |
---|---|
date | Sun, 25 Apr 2010 08:31:47 -0400 |
parents | 74716e9a81cc |
children | 394aa40fd812 |
line wrap: on
line diff
1.1 --- a/modules/bluespec/Pygar/core/Processor.bsv Fri Apr 23 09:35:02 2010 -0400 1.2 +++ b/modules/bluespec/Pygar/core/Processor.bsv Sun Apr 25 08:31:47 2010 -0400 1.3 @@ -30,6 +30,7 @@ 1.4 import SFIFO::*; 1.5 import RWire::*; 1.6 1.7 +import Trace::*; 1.8 import BFIFO::*; 1.9 import MemTypes::*; 1.10 import ProcTypes::*; 1.11 @@ -37,23 +38,24 @@ 1.12 import BranchPred::*; 1.13 //import PathTypes::*; This is only there to force the debugging 1.14 1.15 -import Trace::*; 1.16 - 1.17 //AWB includes 1.18 `include "asim/provides/low_level_platform_interface.bsh" 1.19 `include "asim/provides/soft_connections.bsh" 1.20 `include "asim/provides/common_services.bsh" 1.21 1.22 // Local includes 1.23 -`include "asim/provides/processor_library.bsh" 1.24 +//`include "asim/provides/processor_library.bsh" (included above directly) 1.25 `include "asim/rrr/remote_server_stub_PROCESSORSYSTEMRRR.bsh" 1.26 `include "asim/provides/common_services.bsh" 1.27 `include "asim/dict/STATS_PROCESSOR.bsh" 1.28 1.29 -interface ProcStats; 1.30 - interface Get#(Stat) num_cycles; 1.31 - interface Get#(Stat) num_inst; 1.32 -endinterface 1.33 +// Local includes. Look for the correspondingly named .awb files 1.34 +// workspace/labs/src/mit-6.375/modules/bluespec/mit-6.375/common/ 1.35 +// to find the actual Bluespec files which are used to generate 1.36 +// these includes. These files are specific to this audio processing 1.37 +// pipeline 1.38 + 1.39 +`include "asim/provides/audio_processor_types.bsh" 1.40 1.41 interface CPUToHost; 1.42 method Bit#(32) cpuToHost(int req); 1.43 @@ -68,14 +70,19 @@ 1.44 // Interface for enabling/disabling statistics on the rest of the core 1.45 interface Get#(Bool) statsEn_get; 1.46 1.47 - // Interface for collecting statistics. 1.48 - interface ProcStats stats; 1.49 - 1.50 // Interface to host 1.51 interface CPUToHost tohost; 1.52 1.53 + // Interface to Audio Pipeline 1.54 + interface Audio audio; 1.55 + 1.56 endinterface 1.57 1.58 +//The full interface for this is as below in the common file for audioProcessorTypes.bsv 1.59 +interface Audio; 1.60 + interface Put#(AudioProcessorUnit) audioSampleInput; 1.61 + interface Get#(AudioProcessorUnit) audioSampleOutput; 1.62 +endinterface 1.63 1.64 typedef enum { PCgen, Exec, Writeback } Stage deriving(Eq,Bits); 1.65 1.66 @@ -250,14 +257,19 @@ 1.67 FIFO#(DataReq) dataReqQ <- mkBFIFO1(); 1.68 FIFO#(DataResp) dataRespQ <- mkFIFO(); 1.69 1.70 - // Statistics state 1.71 - Reg#(Stat) num_cycles <- mkReg(0); 1.72 - Reg#(Stat) num_inst <- mkReg(0); 1.73 + // Audio I/O 1.74 + FIFO#(AudioProcessorUnit) inAudioFifo <- mkFIFO; 1.75 + FIFO#(AudioProcessorUnit) outAudioFifo <- mkFIFO; 1.76 + 1.77 + 1.78 + // Statistics state (2010) 1.79 +// Reg#(Stat) num_cycles <- mkReg(0); 1.80 +// Reg#(Stat) num_inst <- mkReg(0); 1.81 1.82 //Or: 1.83 - // Statistics state 1.84 - //STAT num_cycles <- mkStatCounter(`STATS_PROCESSOR_CYCLE_COUNT); 1.85 - //STAT num_inst <- mkStatCounter(`STATS_PROCESSOR_INST_COUNT); 1.86 + // Statistics state 1.87 + STAT num_cycles <- mkStatCounter(`STATS_PROCESSOR_CYCLE_COUNT); 1.88 + STAT num_inst <- mkStatCounter(`STATS_PROCESSOR_INST_COUNT); 1.89 1.90 //----------------------------------------------------------- 1.91 // Rules 1.92 @@ -515,7 +527,7 @@ 1.93 pcQ.deq(); 1.94 1.95 if ( cp0_statsEn ) 1.96 - num_inst <= num_inst+1; 1.97 + num_inst.incr(); 1.98 1.99 endrule 1.100 1.101 @@ -541,20 +553,25 @@ 1.102 1.103 rule inc_num_cycles; 1.104 if ( cp0_statsEn ) 1.105 - num_cycles <= num_cycles+1; 1.106 + num_cycles.incr(); 1.107 endrule 1.108 -// THis rule breaks things 1.109 -// rule handleCPUToHost; 1.110 -// let req <- server_stub.acceptRequest_ReadCPUToHost(); 1.111 -// case (req) 1.112 -// 0: server_stub.sendResponse_ReadCPUToHost(cp0_tohost); 1.113 -// 1: server_stub.sendResponse_ReadCPUToHost(pc); 1.114 -// 2: server_stub.sendResponse_ReadCPUToHost(zeroExtend(pack(stage))); 1.115 -// endcase 1.116 -// endrule 1.117 -//----------------------------------------------------------- 1.118 -// My Adds 1.119 -//----------------------------------------------------------- 1.120 + 1.121 +(* conservative_implicit_conditions *) 1.122 + rule handleCPUToHost; 1.123 + let req <- server_stub.acceptRequest_ReadCPUToHost(); 1.124 + case (req) 1.125 + 0: server_stub.sendResponse_ReadCPUToHost(cp0_tohost); 1.126 + 1: server_stub.sendResponse_ReadCPUToHost(pc); 1.127 + 2: server_stub.sendResponse_ReadCPUToHost(zeroExtend(pack(stage))); 1.128 + endcase 1.129 + endrule 1.130 + 1.131 + // for now, we don't do anything. 1.132 + rule connectAudioReqResp; 1.133 + $display("FIR copies a data"); 1.134 + outAudioFifo.enq(inAudioFifo.first); 1.135 + outAudioFifo.deq; 1.136 + endrule 1.137 1.138 //----------------------------------------------------------- 1.139 // Methods 1.140 @@ -571,11 +588,6 @@ 1.141 1.142 interface Get statsEn_get = toGet(asReg(cp0_statsEn)); 1.143 1.144 - interface ProcStats stats; 1.145 - interface Get num_cycles = toGet(asReg(num_cycles)); 1.146 - interface Get num_inst = toGet(asReg(num_inst)); 1.147 - endinterface 1.148 - 1.149 interface CPUToHost tohost; 1.150 method Bit#(32) cpuToHost(int req); 1.151 return (case (req) 1.152 @@ -586,5 +598,11 @@ 1.153 endmethod 1.154 endinterface 1.155 1.156 + interface Audio audio; 1.157 + interface audioSampleInput = fifoToPut(inAudioFifo); 1.158 + interface audioSampleOutput = fifoToGet(outAudioFifo); 1.159 + endinterface 1.160 + 1.161 + 1.162 endmodule 1.163