Mercurial > pygar
comparison modules/bluespec/Pygar/core/Processor.bsv @ 12:394aa40fd812 pygar svn.13
[svn r13] more stuff
author | punk |
---|---|
date | Tue, 27 Apr 2010 09:02:23 -0400 |
parents | 50af57801d6e |
children | a1833d9f6e3d |
comparison
equal
deleted
inserted
replaced
11:50af57801d6e | 12:394aa40fd812 |
---|---|
43 `include "asim/provides/soft_connections.bsh" | 43 `include "asim/provides/soft_connections.bsh" |
44 `include "asim/provides/common_services.bsh" | 44 `include "asim/provides/common_services.bsh" |
45 | 45 |
46 // Local includes | 46 // Local includes |
47 //`include "asim/provides/processor_library.bsh" (included above directly) | 47 //`include "asim/provides/processor_library.bsh" (included above directly) |
48 `include "asim/rrr/remote_server_stub_PROCESSORSYSTEMRRR.bsh" | 48 `include "asim/rrr/remote_server_stub_AUDIOCORERRR.bsh" |
49 `include "asim/provides/common_services.bsh" | 49 `include "asim/provides/common_services.bsh" |
50 `include "asim/dict/STATS_PROCESSOR.bsh" | 50 `include "asim/dict/STATS_PROCESSOR.bsh" |
51 `include "asim/provides/audio_pipe_types.bsh" | |
51 | 52 |
52 // Local includes. Look for the correspondingly named .awb files | 53 // Local includes. Look for the correspondingly named .awb files |
53 // workspace/labs/src/mit-6.375/modules/bluespec/mit-6.375/common/ | 54 // workspace/labs/src/mit-6.375/modules/bluespec/mit-6.375/common/ |
54 // to find the actual Bluespec files which are used to generate | 55 // to find the actual Bluespec files which are used to generate |
55 // these includes. These files are specific to this audio processing | 56 // these includes. These files are specific to this audio processing |
56 // pipeline | 57 // pipeline |
57 | 58 |
58 `include "asim/provides/audio_processor_types.bsh" | 59 `include "asim/provides/audio_pipe_types.bsh" |
59 | 60 |
60 interface CPUToHost; | 61 //interface CPUToHost; |
61 method Bit#(32) cpuToHost(int req); | 62 // method Bit#(32) cpuToHost(int req); |
62 endinterface | 63 //endinterface |
63 | 64 |
64 interface Proc; | 65 interface Proc; |
65 | 66 |
66 // Interface from processor to caches | 67 // Interface from processor to caches |
67 interface Client#(DataReq,DataResp) dmem_client; | 68 interface Client#(DataReq,DataResp) dmem_client; |
68 interface Client#(InstReq,InstResp) imem_client; | 69 interface Client#(InstReq,InstResp) imem_client; |
69 | 70 |
70 // Interface for enabling/disabling statistics on the rest of the core | 71 // Interface for enabling/disabling statistics on the rest of the core |
71 interface Get#(Bool) statsEn_get; | 72 interface Get#(Bool) statsEn_get; |
72 | 73 |
73 // Interface to host | 74 // // Interface to host |
74 interface CPUToHost tohost; | 75 // interface CPUToHost tohost; |
75 | 76 |
76 // Interface to Audio Pipeline | 77 // Interface to Audio Pipeline |
77 interface Audio audio; | 78 interface AudioOut audioOut; |
78 | 79 |
79 endinterface | 80 endinterface |
80 | 81 |
81 //The full interface for this is as below in the common file for audioProcessorTypes.bsv | 82 //The full interface for this is as below in the common file for audioProcessorTypes.bsv |
82 interface Audio; | 83 interface AudioOut; |
83 interface Put#(AudioProcessorUnit) audioSampleInput; | |
84 interface Get#(AudioProcessorUnit) audioSampleOutput; | 84 interface Get#(AudioProcessorUnit) audioSampleOutput; |
85 endinterface | 85 endinterface |
86 | |
87 //interface AudioIn; | |
88 // interface Put#(AudioProcessorUnit) audioSampleInput; | |
89 //endinterface | |
86 | 90 |
87 typedef enum { PCgen, Exec, Writeback } Stage deriving(Eq,Bits); | 91 typedef enum { PCgen, Exec, Writeback } Stage deriving(Eq,Bits); |
88 | 92 |
89 //----------------------------------------------------------- | 93 //----------------------------------------------------------- |
90 // Register file module | 94 // Register file module |
222 module [CONNECTED_MODULE] mkProc( Proc ); | 226 module [CONNECTED_MODULE] mkProc( Proc ); |
223 | 227 |
224 //----------------------------------------------------------- | 228 //----------------------------------------------------------- |
225 // Debug port | 229 // Debug port |
226 | 230 |
227 ServerStub_PROCESSORSYSTEMRRR server_stub <- mkServerStub_PROCESSORSYSTEMRRR(); | 231 ServerStub_AUDIOCORERRR server_stub <- mkServerStub_AUDIOCORERRR(); |
228 | 232 |
229 | 233 |
230 //----------------------------------------------------------- | 234 //----------------------------------------------------------- |
231 // State | 235 // State |
232 | 236 |
571 $display("FIR copies a data"); | 575 $display("FIR copies a data"); |
572 outAudioFifo.enq(inAudioFifo.first); | 576 outAudioFifo.enq(inAudioFifo.first); |
573 outAudioFifo.deq; | 577 outAudioFifo.deq; |
574 endrule | 578 endrule |
575 | 579 |
580 // Server items & rules: | |
581 | |
582 rule feedInput; | |
583 let command <- server_stub.acceptRequest_SendUnprocessedStream(); | |
584 AudioProcessorControl ctrl = unpack(truncate(command.ctrl)); | |
585 | |
586 if(ctrl == EndOfFile) | |
587 begin | |
588 inAudioFifo.enq(tagged EndOfFile); | |
589 end | |
590 else | |
591 begin | |
592 inAudioFifo.enq(tagged Sample unpack(truncate(command.sample))); | |
593 end | |
594 endrule | |
595 | |
596 | |
576 //----------------------------------------------------------- | 597 //----------------------------------------------------------- |
577 // Methods | 598 // Methods |
578 | 599 |
579 interface Client imem_client; | 600 interface Client imem_client; |
580 interface Get request = toGet(instReqQ); | 601 interface Get request = toGet(instReqQ); |
586 interface Put response = toPut(dataRespQ); | 607 interface Put response = toPut(dataRespQ); |
587 endinterface | 608 endinterface |
588 | 609 |
589 interface Get statsEn_get = toGet(asReg(cp0_statsEn)); | 610 interface Get statsEn_get = toGet(asReg(cp0_statsEn)); |
590 | 611 |
591 interface CPUToHost tohost; | 612 // interface CPUToHost tohost; |
592 method Bit#(32) cpuToHost(int req); | 613 // method Bit#(32) cpuToHost(int req); |
593 return (case (req) | 614 // return (case (req) |
594 0: cp0_tohost; | 615 // 0: cp0_tohost; |
595 1: pc; | 616 // 1: pc; |
596 2: zeroExtend(pack(stage)); | 617 // 2: zeroExtend(pack(stage)); |
597 endcase); | 618 // endcase); |
598 endmethod | 619 // endmethod |
599 endinterface | 620 // endinterface |
600 | 621 |
601 interface Audio audio; | 622 interface AudioOut audio; |
602 interface audioSampleInput = fifoToPut(inAudioFifo); | |
603 interface audioSampleOutput = fifoToGet(outAudioFifo); | 623 interface audioSampleOutput = fifoToGet(outAudioFifo); |
604 endinterface | 624 endinterface |
605 | 625 |
606 | 626 |
607 endmodule | 627 endmodule |