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