Skip to content

Commit

Permalink
Fix cryptosorter benchmark and add a vc707 model.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjyang committed Aug 1, 2015
1 parent 6cf9548 commit 1ed532d
Show file tree
Hide file tree
Showing 7 changed files with 435 additions and 426 deletions.
76 changes: 76 additions & 0 deletions config/pm/leap/workloads/cryptosorter/cryptosorter_vc707.apm
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

[Global]
SaveParameters=0
Description=Traffic Light from Bluespec Tutorial for ACP w. synthesis boundary
File=cryptosorter_vc707
Version=2.2
Name=Cryptosorter on VC707 (Synplify)
DefaultBenchmark=config/bm/leap/demos.cfx/benchmarks/null.cfg
Type=Leap
Class=Asim::Model
DefaultRunOpts=
RootName=HW/SW Hybrid Pipeline Build
RootProvides=model

[Model]
DefaultAttributes=function_as_boundary traffic_light demo connected slave hybrid project
model=HW/SW Hybrid Pipeline Build

[HW/SW Hybrid Pipeline Build]
File=modules/leap/build-support/project/project-pipeline.awb
Packagehint=leap

[HW/SW Hybrid Pipeline Build/Requires]
project_common=Default Hybrid Project Common Utilities
fpgaenv=Hybrid VC707 PCIE FPGA Environment (Synplify)
application_env=Soft Services Hybrid Application Environment

[Soft Services Hybrid Application Environment]
File=modules/leap/build-support/project/application-env/soft-services/application-env-hybrid-soft-service.awb
Packagehint=leap

[Soft Services Hybrid Application Environment/Requires]
connected_application=Cryptosorter application

[Default Hybrid Project Common Utilities]
File=config/pm/leap/submodels/common/project-common-default.apm
Packagehint=leap

[Cryptosorter application/Requires]
cryptosorter_common=Cryptosorter common files
cryptosorter_sort_tree=Cryptosorter Sort Tree
cryptosorter_memory_wrapper=Cryptosorter Memory Wrapper
cryptosorter_control=Cryptosorter Top level control

[Cryptosorter common files]
File=modules/cryptosorter/Common/common.awb
Packagehint=leap-workloads

[Cryptosorter application]
File=modules/cryptosorter/Sorter/connected-application-test.awb
Packagehint=leap-workloads

[Cryptosorter Sort Tree]
File=modules/cryptosorter/SortTree/sort_tree.awb
Packagehint=leap-workloads

[Cryptosorter Top level control]
File=modules/cryptosorter/ctrl/control.awb
Packagehint=leap-workloads

[Cryptosorter Memory Wrapper]
File=modules/cryptosorter/ExternalMemory/external_memory.awb
Packagehint=leap-workloads

[Cryptosorter Sort Tree/Requires]
multifpga_switch=MultiFPGA Switch with Flowcontrol

[MultiFPGA Switch with Flowcontrol]
File=modules/leap/virtual-platform/virtual-devices/devices/multifpga_router_service/flowcontrol/flowcontrol-switch.awb
Packagehint=leap-multifpga



[Hybrid VC707 PCIE FPGA Environment (Synplify)]
File=config/pm/leap/submodels/fpgaenv/fpgaenv-hybrid-vc707-pcie-synplify.apm
Packagehint=leap
2 changes: 1 addition & 1 deletion modules/cryptosorter/Common/DebugFlags.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ Author: Kermin Fleming
// This file contains debug flags for the various system modules. You should
// turn these off when you check in files

Bool debug = True;
Bool sorterDebug = True;

10 changes: 5 additions & 5 deletions modules/cryptosorter/Common/Parameters.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ typedef 8 RecordsPerMemRequest;
// RecAddr in mkCtro.bsv (mdk);
typedef 32'h00800000 MemBankSelector;

interface Read;
interface ReadIfc;
method Action readReq(Addr addr);
method ActionValue#(Record) read();
endinterface

interface Write;
interface WriteIfc;
method Action writeReq(Addr addr);
method Action write(Record record);
endinterface

interface ExternalMemory;
method Bool readsPending();
method Bool writesPending();
interface Read read;
interface Write write;
interface ReadIfc read;
interface WriteIfc write;
endinterface

typedef 32 BlockSize; // Words per burst (4*RecordsPerMemRequest)
Expand Down Expand Up @@ -102,4 +102,4 @@ typedef 16 BeatsPerBurst;
typedef Bit#(30) BlockAddr;
*/
*/
34 changes: 16 additions & 18 deletions modules/cryptosorter/ExternalMemory/ExternalMemory.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,27 @@ module [CONNECTED_MODULE] mkExternalMemory (ExternalMemory);
readRespCount <= readRespCount + 1;
dataStore.readReq(addr);
creditOutfifo.enq(addr);
if(debug) $display("Mem Read Request %h", addr);
if(sorterDebug)
$display("Mem Read Request %h", addr);
endrule

rule doResps;
let data <- dataStore.readRsp();
readRespFIFO.enq(data);
readRespFIFO.enq(data);
endrule

rule doWrites(writeCount < recordsPerMemRequest);
writeCount <= writeCount + 1;
dataStore.write(writeAddr + zeroExtend(writeCount), writeDataFIFO.first);
writeDataFIFO.deq;
if(debug) $display("Mem Write Address %h %h", writeAddr + zeroExtend(writeCount), writeDataFIFO.first);
writeDataFIFO.deq;
if(sorterDebug)
$display("Mem Write Address %h %h", writeAddr + zeroExtend(writeCount), writeDataFIFO.first);
endrule

rule startWrite (writeCount == recordsPerMemRequest);
writeCount <= 0;
writeAddr <= writeAddrFIFO.first >> 2;
writeAddrFIFO.deq;
writeAddrFIFO.deq;
endrule

// This is conservative...
Expand All @@ -109,33 +111,29 @@ module [CONNECTED_MODULE] mkExternalMemory (ExternalMemory);
return writeCount < recordsPerMemRequest || writeDataFIFO.notEmpty;
endmethod

interface Read read;

interface ReadIfc read;
method Action readReq(Addr addr) if(readRespCount == 0);
readRespCount <= 1;
let adjustedAddr = addr >> 2; // Convert to word space.
let adjustedAddr = addr >> 2; // Convert to word space.
dataStore.readReq(adjustedAddr);
creditOutfifo.enq(adjustedAddr);
readAddr <= adjustedAddr;
if(debug) $display("Mem Read Request %h", adjustedAddr);
creditOutfifo.enq(adjustedAddr);
readAddr <= adjustedAddr;
if(sorterDebug)
$display("Mem Read Request %h", adjustedAddr);
endmethod

method ActionValue#(Record) read();
creditOutfifo.deq;
readRespFIFO.deq;
if(debug) $display("Mem Read Response %h %h", creditOutfifo.first, readRespFIFO.first);
if(sorterDebug)
$display("Mem Read Response %h %h", creditOutfifo.first, readRespFIFO.first);
return readRespFIFO.first;
endmethod

endinterface


interface Write write;

interface WriteIfc write;
method writeReq = writeAddrFIFO.enq;

method write = writeDataFIFO.enq;

endinterface

endmodule
Expand Down
52 changes: 21 additions & 31 deletions modules/cryptosorter/ExternalMemory/ExternalMemoryBanked.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module [CONNECTED_MODULE] mkExternalMemory (ExternalMemory);
FIFOF#(Addr) readAddrFIFO <- mkSizedFIFOF(128);
FIFOF#(Record) writeDataFIFO <- mkSizedFIFOF(128);
FIFOF#(Addr) writeAddrFIFO <- mkSizedFIFOF(128/valueof(RecordsPerBlock));
FIFOF#(Addr) creditOutfifo <- mkSizedFIFOF(128);
FIFOF#(Addr) creditOutfifo <- mkSizedFIFOF(128);
FIFOF#(Bank) bankDirection <- mkSizedFIFOF(128);

Addr bank_mask = fromInteger(valueOf(MemBankSelector))>>6;
Expand All @@ -87,8 +87,7 @@ module [CONNECTED_MODULE] mkExternalMemory (ExternalMemory);
rule doReads(readRespCount > 0);
let addr = readAddr + zeroExtend(readRespCount);
readRespCount <= readRespCount + 1;

if(addr < bank_mask)
if(addr < bank_mask)
begin
dataStoreA.readReq(addr);
bankDirection.enq(BANK_A);
Expand All @@ -98,45 +97,44 @@ module [CONNECTED_MODULE] mkExternalMemory (ExternalMemory);
dataStoreB.readReq(addr);
bankDirection.enq(BANK_B);
end

creditOutfifo.enq(addr);
if(debug) $display("Mem Read Request %h", addr);
if(sorterDebug)
$display("Mem Read Request %h", addr);
endrule

rule doRespsA(bankDirection.first == BANK_A);
let data <- dataStoreA.readRsp();
readRespFIFO.enq(data);
readRespFIFO.enq(data);
bankDirection.deq;
endrule

rule doRespsB(bankDirection.first == BANK_B);
let data <- dataStoreB.readRsp();
readRespFIFO.enq(data);
readRespFIFO.enq(data);
bankDirection.deq;
endrule

rule doWrites(writeCount < recordsPerMemRequest);
writeCount <= writeCount + 1;
let addr = writeAddr + zeroExtend(writeCount);
let addr = writeAddr + zeroExtend(writeCount);

if(addr < bank_mask)
if(addr < bank_mask)
begin
dataStoreA.write(addr, writeDataFIFO.first);
end
else
begin
dataStoreB.write(addr, writeDataFIFO.first);
end

writeDataFIFO.deq;

if(debug) $display("Mem Write Address %h %h", addr, writeDataFIFO.first);
writeDataFIFO.deq;
if(sorterDebug)
$display("Mem Write Address %h %h", addr, writeDataFIFO.first);
endrule

rule startWrite (writeCount == recordsPerMemRequest);
writeCount <= 0;
writeAddr <= writeAddrFIFO.first >> 2;
writeAddrFIFO.deq;
writeAddrFIFO.deq;
endrule

// This is conservative...
Expand All @@ -148,12 +146,10 @@ module [CONNECTED_MODULE] mkExternalMemory (ExternalMemory);
return writeCount < recordsPerMemRequest || writeDataFIFO.notEmpty;
endmethod

interface Read read;

interface ReadIfc read;
method Action readReq(Addr addr) if(readRespCount == 0);
readRespCount <= 1;
let adjustedAddr = addr >> 2; // Convert to word space.

let adjustedAddr = addr >> 2; // Convert to word space.
if(adjustedAddr < bank_mask)
begin
dataStoreA.readReq(adjustedAddr);
Expand All @@ -164,33 +160,27 @@ module [CONNECTED_MODULE] mkExternalMemory (ExternalMemory);
dataStoreB.readReq(adjustedAddr);
bankDirection.enq(BANK_B);
end

creditOutfifo.enq(adjustedAddr);
readAddr <= adjustedAddr;
if(debug) $display("Mem Read Request %h", adjustedAddr);
creditOutfifo.enq(adjustedAddr);
readAddr <= adjustedAddr;
if(sorterDebug)
$display("Mem Read Request %h", adjustedAddr);
endmethod

method ActionValue#(Record) read();
creditOutfifo.deq;
readRespFIFO.deq;
if(debug) $display("Mem Read Response %h %h", creditOutfifo.first, readRespFIFO.first);
if(sorterDebug)
$display("Mem Read Response %h %h", creditOutfifo.first, readRespFIFO.first);
return readRespFIFO.first;
endmethod

endinterface


interface Write write;

interface WriteIfc write;
method writeReq = writeAddrFIFO.enq;

method write = writeDataFIFO.enq;

endinterface

endmodule





2 changes: 1 addition & 1 deletion modules/cryptosorter/Sorter/connected-application-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ CONNECTED_APPLICATION_CLASS::Main()
}
}

STARTER_DEVICE_SERVER_CLASS::GetInstance()->End(0);
STARTER_SERVICE_SERVER_CLASS::GetInstance()->End(0);

return 0;
}
Loading

0 comments on commit 1ed532d

Please sign in to comment.