Mercurial > pygar
comparison modules/bluespec/Pygar/core/audioCorePipeline.bsv @ 52:49049f97312c pygar svn.53
[svn r53] sends to two cores (but has issues)
author | punk |
---|---|
date | Thu, 06 May 2010 08:57:53 -0400 |
parents | 9fe5ed4af92d |
children | 2991344775f8 |
comparison
equal
deleted
inserted
replaced
51:9fe5ed4af92d | 52:49049f97312c |
---|---|
25 import Connectable::*; | 25 import Connectable::*; |
26 import GetPut::*; | 26 import GetPut::*; |
27 import ClientServer::*; | 27 import ClientServer::*; |
28 import FIFO::*; | 28 import FIFO::*; |
29 import SpecialFIFOs::*; | 29 import SpecialFIFOs::*; |
30 import Vector::*; | |
30 | 31 |
31 //AWB includes | 32 //AWB includes |
32 `include "asim/provides/low_level_platform_interface.bsh" | 33 `include "asim/provides/low_level_platform_interface.bsh" |
33 `include "asim/provides/soft_connections.bsh" | 34 `include "asim/provides/soft_connections.bsh" |
34 `include "asim/provides/common_services.bsh" | 35 `include "asim/provides/common_services.bsh" |
46 `include "asim/rrr/remote_server_stub_AUDIOCORERRR.bsh" | 47 `include "asim/rrr/remote_server_stub_AUDIOCORERRR.bsh" |
47 | 48 |
48 module [CONNECTED_MODULE] mkConnectedApplication (); | 49 module [CONNECTED_MODULE] mkConnectedApplication (); |
49 Core core <- mkCore(`VDEV_SCRATCH_MEMORYA); | 50 Core core <- mkCore(`VDEV_SCRATCH_MEMORYA); |
50 Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB); | 51 Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB); |
51 // RLM:: | 52 |
52 // the simple existance of this additional core causes the dreaded | |
53 // beast to emerge --- the ASSERTION FAILURE: sw/model/stats-device.cpp:317 Cycle:0 | |
54 //stats device: Duplicate entry DATA_CACHE_NUM_WRITEBACKS, postion 0 | |
55 //Core core1 <- mkCore; | |
56 Reg#(int) cycle <- mkReg(0); | 53 Reg#(int) cycle <- mkReg(0); |
57 | 54 Vector#(2, Reg#(Bool)) ac_fini <- replicateM(mkReg(False)); |
58 // Reg#(Bit#(32)) ac_fini <- mkReg(0); | |
59 | |
60 //External memory | |
61 // I'm not comfortable assuming that the memory subsystem is in order | |
62 // So I'll insert a completion buffer here. | |
63 | 55 |
64 // Services Samples | 56 // Services Samples |
65 ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR(); | 57 ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR(); |
66 | 58 |
67 | 59 |
80 rule feedOutput; | 72 rule feedOutput; |
81 let pipelineData <- core.sampleOutput.get(); | 73 let pipelineData <- core.sampleOutput.get(); |
82 AudioProcessorControl endOfFileTag = EndOfFile; | 74 AudioProcessorControl endOfFileTag = EndOfFile; |
83 AudioProcessorControl sampleTag = Data; | 75 AudioProcessorControl sampleTag = Data; |
84 | 76 |
77 $display("PIPE writes sample\n"); | |
85 case (pipelineData) matches | 78 case (pipelineData) matches |
86 tagged EndOfFile: | 79 tagged EndOfFile: |
87 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?); | 80 begin |
88 tagged Sample .sample:client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); | 81 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?); |
82 ac_fini[0] <= True; | |
83 end | |
84 tagged Sample .sample: | |
85 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); | |
89 endcase | 86 endcase |
90 endrule | 87 endrule |
91 | 88 |
89 // Programming ghetto style! | |
90 // right now I am repeating this rule for my second core. | |
91 (* conservative_implicit_conditions *) | |
92 rule feedAnotherOutput; | |
93 let pipelineData <- anotherCore.sampleOutput.get(); | |
94 AudioProcessorControl endOfFileTag = EndOfFile; | |
95 AudioProcessorControl sampleTag = Data; | |
96 | |
97 $display("PIPE writes another sample\n"); | |
98 case (pipelineData) matches | |
99 tagged EndOfFile: | |
100 begin | |
101 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?); | |
102 ac_fini[1] <= True; | |
103 end | |
104 tagged Sample .sample: | |
105 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); | |
106 endcase | |
107 endrule | |
108 | |
109 | |
110 // Can generally just stick with the EOF but since I have two Cores no mixer... | |
111 /*(* conservative_implicit_conditions *) | |
112 rule sendTerminate; | |
113 Bool done = True; | |
114 for (Integer i = 1; i < 2; i = i+1) | |
115 done = ac_fini[i] && done; | |
116 | |
117 if (done) | |
118 client_stub.makeRequest_SendTerminate(zeroExtend(pack(1))); | |
119 | |
120 endrule | |
121 */ | |
122 | |
92 //***** SERVER Side ***** | 123 //***** SERVER Side ***** |
93 | 124 |
94 /* (* conservative_implicit_conditions *) | 125 (* conservative_implicit_conditions *) |
95 rule handleCPUToHost; | |
96 let req <- server_stub.acceptRequest_ReadCPUToHost(); | |
97 case (req) | |
98 0: server_stub.sendResponse_ReadCPUToHost(cp0_tohost); | |
99 endcase | |
100 endrule | |
101 */ | |
102 rule feedInput; | 126 rule feedInput; |
103 let command <- server_stub.acceptRequest_SendUnprocessedStream(); | 127 let command <- server_stub.acceptRequest_SendUnprocessedStream(); |
104 AudioProcessorControl ctrl = unpack(truncate(command.ctrl)); | 128 AudioProcessorControl ctrl = unpack(truncate(command.ctrl)); |
105 | 129 |
106 Bit#(32) test = unpack(truncate(command.channel)); | 130 VoiceId channel = unpack(truncate(command.channel)); |
107 // $display("rlm: %x", test); | 131 // $display("rlm: %x", test); |
108 | 132 |
109 | 133 AudioProcessorUnit inSample; |
110 if(ctrl == EndOfFile) | 134 |
111 begin | 135 if(ctrl == EndOfFile) |
136 begin | |
112 $display("lsp: PIPE received EOF "); | 137 $display("lsp: PIPE received EOF "); |
113 core.sampleInput.put(tagged EndOfFile); | 138 inSample = tagged EndOfFile; |
139 // core.sampleInput.put(tagged EndOfFile); | |
114 end | 140 end |
115 else | 141 else |
116 begin | 142 begin |
117 // $display("lsp: PIPE received Data "); | 143 // $display("lsp: PIPE received Data "); |
118 core.sampleInput.put(tagged Sample unpack(truncate(command.sample))); | 144 // core.sampleInput.put(tagged Sample unpack(truncate(command.sample))); |
119 end | 145 inSample = tagged Sample unpack(truncate(command.sample)); |
146 end | |
147 | |
148 case (channel) | |
149 0 : core.sampleInput.put(inSample); | |
150 1 : anotherCore.sampleInput.put(inSample); | |
151 endcase | |
152 | |
120 endrule | 153 endrule |
121 endmodule | 154 endmodule |