annotate modules/bluespec/Pygar/core/audioCorePipeline.bsv @ 48:a139cc07b773 pygar svn.49

[svn r49] moved memory into core
author punk
date Wed, 05 May 2010 13:42:07 -0400
parents 97d1959f7c5c
children 9fe5ed4af92d
rev   line source
punk@13 1 // The MIT License
punk@13 2
punk@13 3 // Copyright (c) 2009 Massachusetts Institute of Technology
punk@13 4
punk@13 5 // Permission is hereby granted, free of charge, to any person obtaining a copy
punk@13 6 // of this software and associated documentation files (the "Software"), to deal
punk@13 7 // in the Software without restriction, including without limitation the rights
punk@13 8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
punk@13 9 // copies of the Software, and to permit persons to whom the Software is
punk@13 10 // furnished to do so, subject to the following conditions:
punk@13 11
punk@13 12 // The above copyright notice and this permission notice shall be included in
punk@13 13 // all copies or substantial portions of the Software.
punk@13 14
punk@13 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
punk@13 16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
punk@13 17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
punk@13 18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
punk@13 19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
punk@13 20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
punk@13 21 // THE SOFTWARE.
punk@13 22
punk@13 23 // Author: Kermin Fleming kfleming@mit.edu
punk@13 24
punk@13 25 import Connectable::*;
punk@13 26 import GetPut::*;
punk@13 27 import ClientServer::*;
punk@13 28 import FIFO::*;
punk@15 29 import SpecialFIFOs::*;
punk@13 30
punk@13 31 //AWB includes
punk@13 32 `include "asim/provides/low_level_platform_interface.bsh"
punk@13 33 `include "asim/provides/soft_connections.bsh"
punk@13 34 `include "asim/provides/common_services.bsh"
punk@13 35
punk@13 36 //Local includes
punk@13 37 `include "asim/provides/audio_pipe_types.bsh" //provides Audio Pipeline interface
punk@33 38 `include "asim/provides/path_types.bsh"
punk@13 39 `include "asim/provides/core.bsh"
punk@43 40 `include "asim/provides/mixer.bsh"
punk@15 41 `include "asim/provides/processor_library.bsh"
punk@15 42 `include "asim/provides/fpga_components.bsh"
punk@33 43
punk@13 44 `include "asim/rrr/remote_client_stub_AUDIOCORERRR.bsh"
punk@36 45 `include "asim/rrr/remote_server_stub_AUDIOCORERRR.bsh"
punk@13 46
punk@13 47 module [CONNECTED_MODULE] mkConnectedApplication ();
punk@13 48 Core core <- mkCore;
rlm@47 49 // RLM::
rlm@47 50 // the simple existance of this additional core causes the dreaded
rlm@47 51 // beast to emerge --- the ASSERTION FAILURE: sw/model/stats-device.cpp:317 Cycle:0
rlm@47 52 //stats device: Duplicate entry DATA_CACHE_NUM_WRITEBACKS, postion 0
rlm@47 53 //Core core1 <- mkCore;
punk@13 54 Reg#(int) cycle <- mkReg(0);
punk@13 55
punk@39 56 // Reg#(Bit#(32)) ac_fini <- mkReg(0);
punk@39 57
punk@13 58 //External memory
punk@13 59 // I'm not comfortable assuming that the memory subsystem is in order
punk@33 60 // So I'll insert a completion buffer here.
punk@33 61
punk@33 62 // Services Samples
punk@15 63 ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR();
punk@48 64
punk@13 65
punk@36 66 //-----------------------------------------------------------
punk@36 67 // Debug port
punk@36 68
punk@36 69 ServerStub_AUDIOCORERRR server_stub <- mkServerStub_AUDIOCORERRR();
punk@36 70
punk@36 71
punk@13 72 // this is for the tracing
punk@13 73 rule printCycles;
punk@13 74 cycle <= cycle+1;
punk@13 75 $fdisplay(stderr, " => Cycle = %d", cycle);
punk@13 76 endrule
punk@13 77
punk@48 78 rule feedOutput;
punk@13 79 let pipelineData <- core.sampleOutput.get();
punk@13 80 AudioProcessorControl endOfFileTag = EndOfFile;
punk@13 81 AudioProcessorControl sampleTag = Data;
punk@13 82
punk@25 83 case (pipelineData) matches
punk@25 84 tagged EndOfFile:
punk@15 85 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?);
punk@25 86 tagged Sample .sample:client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample)));
punk@25 87 endcase
punk@13 88 endrule
punk@13 89
punk@36 90 //***** SERVER Side *****
punk@36 91
punk@39 92 /* (* conservative_implicit_conditions *)
punk@37 93 rule handleCPUToHost;
punk@37 94 let req <- server_stub.acceptRequest_ReadCPUToHost();
punk@37 95 case (req)
punk@37 96 0: server_stub.sendResponse_ReadCPUToHost(cp0_tohost);
punk@37 97 endcase
punk@37 98 endrule
punk@39 99 */
punk@36 100 rule feedInput;
punk@36 101 let command <- server_stub.acceptRequest_SendUnprocessedStream();
punk@36 102 AudioProcessorControl ctrl = unpack(truncate(command.ctrl));
rlm@41 103
rlm@41 104 Bit#(32) test = unpack(truncate(command.channel));
punk@48 105 // $display("rlm: %x", test);
rlm@41 106
rlm@41 107
rlm@41 108 if(ctrl == EndOfFile)
punk@36 109 begin
punk@43 110 $display("lsp: PIPE received EOF ");
punk@43 111 core.sampleInput.put(tagged EndOfFile);
punk@36 112 end
punk@36 113 else
punk@36 114 begin
punk@43 115 // $display("lsp: PIPE received Data ");
punk@43 116 core.sampleInput.put(tagged Sample unpack(truncate(command.sample)));
punk@36 117 end
punk@36 118 endrule
punk@13 119 endmodule