annotate modules/bluespec/Pygar/core/audioPipe.bsv~ @ 65:cf8bb3038cbd pygar svn.66

[svn r66] sim passes
author punk
date Tue, 11 May 2010 09:05:22 -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 module [CONNECTED_MODULE] mkConnectedApplication ();
punk@33 49 Core core <- mkCore;
punk@33 50 Reg#(int) cycle <- mkReg(0);
punk@33 51
punk@33 52 //mkMixer();
punk@33 53
punk@33 54 //External memory
punk@33 55 // I'm not comfortable assuming that the memory subsystem is in order
punk@33 56 // So I'll insert a completion buffer here.
punk@33 57 MEMORY_IFC#(Bit#(18), Bit#(32)) memory <- mkScratchpad(`VDEV_SCRATCH_MEMORY, SCRATCHPAD_CACHED); //Services Memory items
punk@33 58
punk@33 59 // Services Samples
punk@33 60 ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR();
punk@33 61 // Make this big enough so that several outstanding requests may be supported
punk@33 62 FIFO#(Bit#(MainMemTagSz)) tags <- mkSizedFIFO(8);
punk@33 63
punk@33 64 // this is for the tracing
punk@33 65 rule printCycles;
punk@33 66 cycle <= cycle+1;
punk@33 67 $fdisplay(stderr, " => Cycle = %d", cycle);
punk@33 68 endrule
punk@33 69
punk@33 70 rule sendMemReq;
punk@33 71 let coreReq <- core.mmem_client.request.get;
punk@33 72 case (coreReq) matches
punk@33 73 tagged LoadReq .load: begin
punk@33 74 //Allocate ROB space
punk@33 75 memory.readReq(truncate(load.addr>>2));
punk@33 76 tags.enq(load.tag);
punk@33 77 end
punk@33 78 tagged StoreReq .store: begin
punk@33 79 memory.write(truncate(store.addr>>2),store.data);
punk@33 80 end
punk@33 81 endcase
punk@33 82 endrule
punk@33 83
punk@33 84 rule receiveMemResp;
punk@33 85 let memResp <- memory.readRsp();
punk@33 86 tags.deq;
punk@33 87 core.mmem_client.response.put(tagged LoadResp {data:memResp,
punk@33 88 tag: tags.first});
punk@33 89 endrule
punk@33 90
punk@33 91 rule feedOutput;
punk@33 92 let pipelineData <- core.sampleOutput.get();
punk@33 93 AudioProcessorControl endOfFileTag = EndOfFile;
punk@33 94 AudioProcessorControl sampleTag = Data;
punk@33 95
punk@33 96 case (pipelineData) matches
punk@33 97 tagged EndOfFile:
punk@33 98 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?);
punk@33 99 tagged Sample .sample:client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample)));
punk@33 100 endcase
punk@33 101 endrule
punk@33 102
punk@33 103 endmodule