Mercurial > pygar
comparison modules/bluespec/Pygar/core/audioCorePipeline.bsv @ 53:2991344775f8 pygar svn.54
[svn r54] mixer integrated
author | punk |
---|---|
date | Sun, 09 May 2010 10:58:40 -0400 |
parents | 49049f97312c |
children | 9b4f237e77e1 |
comparison
equal
deleted
inserted
replaced
52:49049f97312c | 53:2991344775f8 |
---|---|
47 `include "asim/rrr/remote_server_stub_AUDIOCORERRR.bsh" | 47 `include "asim/rrr/remote_server_stub_AUDIOCORERRR.bsh" |
48 | 48 |
49 module [CONNECTED_MODULE] mkConnectedApplication (); | 49 module [CONNECTED_MODULE] mkConnectedApplication (); |
50 Core core <- mkCore(`VDEV_SCRATCH_MEMORYA); | 50 Core core <- mkCore(`VDEV_SCRATCH_MEMORYA); |
51 Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB); | 51 Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB); |
52 | 52 Vector#(2, Volume) channelVols = replicate(127); |
53 Mixer mixer <- mkMixer(2, channelVols); //should be max voices but 2 for now | |
54 | |
53 Reg#(int) cycle <- mkReg(0); | 55 Reg#(int) cycle <- mkReg(0); |
56 Reg#(int) sampleCount <-mkReg(0); | |
54 Vector#(2, Reg#(Bool)) ac_fini <- replicateM(mkReg(False)); | 57 Vector#(2, Reg#(Bool)) ac_fini <- replicateM(mkReg(False)); |
55 | 58 |
56 // Services Samples | 59 // FIFO#(AudioProcessorUnit) coreOut <- mkFIFO(); |
57 ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR(); | 60 // Services Samples |
61 ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR(); | |
58 | 62 |
59 | 63 |
60 //----------------------------------------------------------- | 64 //----------------------------------------------------------- |
61 // Debug port | 65 // Debug port |
62 | 66 |
67 rule printCycles; | 71 rule printCycles; |
68 cycle <= cycle+1; | 72 cycle <= cycle+1; |
69 $fdisplay(stderr, " => Cycle = %d", cycle); | 73 $fdisplay(stderr, " => Cycle = %d", cycle); |
70 endrule | 74 endrule |
71 | 75 |
76 // Send to Mixer | |
77 // Right now this is sorta retarded in that I pass from the output fifo into a new fifo | |
78 // But I have to mod a bunch of things to fix this and I am not sure I understand | |
79 // things well enough to do this quickly. So here it is as it is for now. | |
80 rule mix; | |
81 let coreOut <- core.sampleOutput.get(); | |
82 let anotherOut <- anotherCore.sampleOutput.get(); | |
83 mixer.toMixer(AudioStream {voice : 0, data : tagged Valid coreOut}); | |
84 mixer.toMixer(AudioStream {voice : 1, data : tagged Valid anotherOut}); | |
85 endrule | |
86 | |
72 rule feedOutput; | 87 rule feedOutput; |
73 let pipelineData <- core.sampleOutput.get(); | 88 // let pipelineData <- core.sampleOutput.get(); |
89 let pipeOut <- mixer.mainOut.get(); | |
90 | |
74 AudioProcessorControl endOfFileTag = EndOfFile; | 91 AudioProcessorControl endOfFileTag = EndOfFile; |
75 AudioProcessorControl sampleTag = Data; | 92 AudioProcessorControl sampleTag = Data; |
76 | 93 |
77 $display("PIPE writes sample\n"); | 94 sampleCount <= sampleCount+1; |
78 case (pipelineData) matches | 95 |
96 $display("PIPE writes sample %x\n", sampleCount); | |
97 case (pipeOut) matches | |
79 tagged EndOfFile: | 98 tagged EndOfFile: |
80 begin | 99 begin |
81 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?); | 100 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?); |
82 ac_fini[0] <= True; | 101 ac_fini[0] <= True; |
83 end | 102 end |
84 tagged Sample .sample: | 103 tagged Sample .sample: |
85 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); | 104 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); |
86 endcase | 105 endcase |
87 endrule | 106 endrule |
88 | 107 |
89 // Programming ghetto style! | 108 // Programming ghetto style! |
90 // right now I am repeating this rule for my second core. | 109 // right now I am repeating this rule for my second core. |
91 (* conservative_implicit_conditions *) | 110 /* (* conservative_implicit_conditions *) |
92 rule feedAnotherOutput; | 111 rule feedAnotherOutput; |
93 let pipelineData <- anotherCore.sampleOutput.get(); | 112 let pipelineData <- anotherCore.sampleOutput.get(); |
94 AudioProcessorControl endOfFileTag = EndOfFile; | 113 AudioProcessorControl endOfFileTag = EndOfFile; |
95 AudioProcessorControl sampleTag = Data; | 114 AudioProcessorControl sampleTag = Data; |
96 | 115 |
103 end | 122 end |
104 tagged Sample .sample: | 123 tagged Sample .sample: |
105 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); | 124 client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); |
106 endcase | 125 endcase |
107 endrule | 126 endrule |
108 | 127 */ |
109 | 128 |
110 // Can generally just stick with the EOF but since I have two Cores no mixer... | 129 // Can generally just stick with the EOF but since I have two Cores no mixer... |
111 /*(* conservative_implicit_conditions *) | 130 /*(* conservative_implicit_conditions *) |
112 rule sendTerminate; | 131 rule sendTerminate; |
113 Bool done = True; | 132 Bool done = True; |