annotate modules/bluespec/Pygar/core/audioPipe.bsv @ 42:ced2ebd41347 pygar svn.43

[svn r43] bunch of updates that almost work...
author punk
date Wed, 05 May 2010 01:09:09 -0400
parents 2c8166d205d5
children
rev   line source
punk@33 1 // The MIT License
punk@33 2
punk@33 3 // Copyright (c) 2009 Massachusetts Institute of Technology
punk@33 4
punk@33 5 // Permission is hereby granted, free of charge, to any person obtaining a copy
punk@33 6 // of this software and associated documentation files (the "Software"), to deal
punk@33 7 // in the Software without restriction, including without limitation the rights
punk@33 8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
punk@33 9 // copies of the Software, and to permit persons to whom the Software is
punk@33 10 // furnished to do so, subject to the following conditions:
punk@33 11
punk@33 12 // The above copyright notice and this permission notice shall be included in
punk@33 13 // all copies or substantial portions of the Software.
punk@33 14
punk@33 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
punk@33 16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
punk@33 17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
punk@33 18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
punk@33 19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
punk@33 20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
punk@33 21 // THE SOFTWARE.
punk@33 22
punk@33 23 // Author: Kermin Fleming kfleming@mit.edu
punk@33 24
punk@33 25 import Connectable::*;
punk@33 26 import GetPut::*;
punk@33 27 import ClientServer::*;
punk@33 28 import FIFO::*;
punk@33 29 import SpecialFIFOs::*;
punk@33 30
punk@33 31 //AWB includes
punk@33 32 `include "asim/provides/low_level_platform_interface.bsh"
punk@33 33 `include "asim/provides/soft_connections.bsh"
punk@33 34 `include "asim/provides/common_services.bsh"
punk@33 35
punk@33 36 //Local includes
punk@33 37 `include "asim/provides/audio_pipe_types.bsh" //provides Audio Pipeline interface
punk@33 38 `include "asim/provides/core.bsh"
punk@33 39 `include "asim/provides/processor_library.bsh"
punk@33 40 `include "asim/provides/fpga_components.bsh"
punk@33 41 `include "asim/provides/scratchpad_memory.bsh"
punk@33 42 `include "asim/provides/mem_services.bsh"
punk@33 43 `include "asim/dict/VDEV_SCRATCH.bsh"
punk@33 44
punk@33 45 `include "asim/rrr/remote_client_stub_AUDIOCORERRR.bsh"
punk@33 46 //`include "asim/rrr/remote_server_stub_AUDIOCORERRR.bsh"
punk@33 47
punk@33 48 function
punk@33 49 module [CONNECTED_MODULE] mkConnectedApplication ();
punk@33 50 Core core <- mkCore;
punk@33 51 Reg#(int) cycle <- mkReg(0);
punk@33 52
punk@33 53
punk@33 54 //get volumes
punk@33 55 //mkMixer();
punk@33 56
punk@33 57 //External memory
punk@33 58 // I'm not comfortable assuming that the memory subsystem is in order
punk@33 59 // So I'll insert a completion buffer here.
punk@33 60 MEMORY_IFC#(Bit#(18), Bit#(32)) memory <- mkScratchpad(`VDEV_SCRATCH_MEMORY, SCRATCHPAD_CACHED); //Services Memory items
punk@33 61
punk@33 62 // Services Samples
punk@33 63 ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR();
punk@33 64 // Make this big enough so that several outstanding requests may be supported
punk@33 65 FIFO#(Bit#(MainMemTagSz)) tags <- mkSizedFIFO(8);
punk@33 66
punk@33 67 // this is for the tracing
punk@33 68 rule printCycles;
punk@33 69 cycle <= cycle+1;
punk@33 70 $fdisplay(stderr, " => Cycle = %d", cycle);
punk@33 71 endrule
punk@33 72
punk@33 73 rule sendMemReq;
punk@33 74 let coreReq <- core.mmem_client.request.get;
punk@33 75 case (coreReq) matches
punk@33 76 tagged LoadReq .load: begin
punk@33 77 //Allocate ROB space
punk@33 78 memory.readReq(truncate(load.addr>>2));
punk@33 79 tags.enq(load.tag);
punk@33 80 end
punk@33 81 tagged StoreReq .store: begin
punk@33 82 memory.write(truncate(store.addr>>2),store.data);
punk@33 83 end
punk@33 84 endcase
punk@33 85 endrule
punk@33 86
punk@33 87 rule receiveMemResp;
punk@33 88 let memResp <- memory.readRsp();
punk@33 89 tags.deq;
punk@33 90 core.mmem_client.response.put(tagged LoadResp {data:memResp,
punk@33 91 tag: tags.first});
punk@33 92 endrule
punk@33 93
punk@33 94 rule feedOutput;
punk@33 95 let pipelineData <- core.sampleOutput.get();
punk@33 96 AudioProcessorControl endOfFileTag = EndOfFile;
punk@33 97 AudioProcessorControl sampleTag = Data;
punk@33 98
punk@33 99 case (pipelineData) matches
punk@33 100 tagged EndOfFile:
punk@33 101 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?);
punk@33 102 tagged Sample .sample:client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample)));
punk@33 103 endcase
punk@33 104 endrule
punk@33 105
punk@33 106 endmodule