//----------------------------------------------------------------------//
|
//----------------------------------------------------------------------//
|
// The MIT License
|
// The MIT License
|
//
|
//
|
// Copyright (c) 2008 Kermin Fleming, kfleming@mit.edu
|
// Copyright (c) 2008 Kermin Fleming, kfleming@mit.edu
|
//
|
//
|
// Permission is hereby granted, free of charge, to any person
|
// Permission is hereby granted, free of charge, to any person
|
// obtaining a copy of this software and associated documentation
|
// obtaining a copy of this software and associated documentation
|
// files (the "Software"), to deal in the Software without
|
// files (the "Software"), to deal in the Software without
|
// restriction, including without limitation the rights to use,
|
// restriction, including without limitation the rights to use,
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
// copies of the Software, and to permit persons to whom the
|
// copies of the Software, and to permit persons to whom the
|
// Software is furnished to do so, subject to the following conditions:
|
// Software is furnished to do so, subject to the following conditions:
|
//
|
//
|
// The above copyright notice and this permission notice shall be
|
// The above copyright notice and this permission notice shall be
|
// included in all copies or substantial portions of the Software.
|
// included in all copies or substantial portions of the Software.
|
//
|
//
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
//----------------------------------------------------------------------//
|
//----------------------------------------------------------------------//
|
/*
|
/*
|
Copyright (c) 2008 MIT
|
Copyright (c) 2008 MIT
|
|
|
Permission is hereby granted, free of charge, to any person
|
Permission is hereby granted, free of charge, to any person
|
obtaining a copy of this software and associated documentation
|
obtaining a copy of this software and associated documentation
|
files (the "Software"), to deal in the Software without
|
files (the "Software"), to deal in the Software without
|
restriction, including without limitation the rights to use,
|
restriction, including without limitation the rights to use,
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
copies of the Software, and to permit persons to whom the
|
copies of the Software, and to permit persons to whom the
|
Software is furnished to do so, subject to the following
|
Software is furnished to do so, subject to the following
|
conditions:
|
conditions:
|
|
|
The above copyright notice and this permission notice shall be
|
The above copyright notice and this permission notice shall be
|
included in all copies or substantial portions of the Software.
|
included in all copies or substantial portions of the Software.
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
OTHER DEALINGS IN THE SOFTWARE.
|
OTHER DEALINGS IN THE SOFTWARE.
|
|
|
Author: Kermin Fleming
|
Author: Kermin Fleming
|
*/
|
*/
|
|
|
/* This is the top-level sorter module. It interfaces to the PLB bus, the
|
/* This is the top-level sorter module. It interfaces to the PLB bus, the
|
DSOCM, and the sorter core. Not much functionality, but it does have
|
DSOCM, and the sorter core. Not much functionality, but it does have
|
a cycle timer, and sends periodic messages back to the PPC over the
|
a cycle timer, and sends periodic messages back to the PPC over the
|
DSOCM
|
DSOCM
|
*/
|
*/
|
|
|
// Bluespec Lib
|
// Bluespec Lib
|
import FIFO::*;
|
import FIFO::*;
|
import GetPut::*;
|
import GetPut::*;
|
import Vector::*;
|
import Vector::*;
|
import Connectable::*;
|
import Connectable::*;
|
|
|
// CSG Lib
|
// CSG Lib
|
import PLBMasterWires::*;
|
import PLBMasterWires::*;
|
import BRAMInitiatorWires::*;
|
import BRAMInitiatorWires::*;
|
import PLBMaster::*;
|
import PLBMaster::*;
|
import BRAMFeeder::*;
|
import BRAMFeeder::*;
|
import PLBMaster::*;
|
import PLBMaster::*;
|
import PLBMasterDefaultParameters::*;
|
import PLBMasterDefaultParameters::*;
|
|
|
// Local includes
|
// Local includes
|
import CompressionFunction::*;
|
import CompressionFunction::*;
|
import CompressionFunctionLibrary::*;
|
import CompressionFunctionLibrary::*;
|
import MD6Parameters::*;
|
import MD6Parameters::*;
|
import MD6Types::*;
|
import MD6Types::*;
|
|
|
|
|
interface MD6Engine;
|
interface MD6Engine;
|
interface PLBMasterWires plbMasterWires;
|
interface PLBMasterWires plbMasterWires;
|
interface BRAMInitiatorWires#(Bit#(14)) bramInitiatorWires;
|
interface BRAMInitiatorWires#(Bit#(14)) bramInitiatorWires;
|
endinterface
|
endinterface
|
|
|
// Might consider making this size 8 at some point so that it jives with
|
// Might consider making this size 8 at some point so that it jives with
|
// other parameterizations
|
// other parameterizations
|
typedef 16 InterfaceRegister;
|
typedef 16 InterfaceRegister;
|
typedef Bit#(15) RegisterTag;
|
typedef Bit#(15) RegisterTag;
|
|
|
typedef enum {
|
typedef enum {
|
Read = 0,
|
Read = 0,
|
Write = 1
|
Write = 1
|
} Command deriving (Bits,Eq);
|
} Command deriving (Bits,Eq);
|
|
|
|
|
typedef 7 ControlRegisters;
|
typedef 7 ControlRegisters;
|
typedef TMul#(MD6_u,TDiv#(MD6_WordWidth,InterfaceRegister)) IdentifierRegisters;
|
typedef TMul#(MD6_u,TDiv#(MD6_WordWidth,InterfaceRegister)) IdentifierRegisters;
|
typedef TMul#(MD6_k,TDiv#(MD6_WordWidth,InterfaceRegister)) KeyRegisters;
|
typedef TMul#(MD6_k,TDiv#(MD6_WordWidth,InterfaceRegister)) KeyRegisters;
|
typedef 2 SourceRegisters;
|
typedef 2 SourceRegisters;
|
typedef 2 DestinationRegisters;
|
typedef 2 DestinationRegisters;
|
|
|
typedef 0 RoundRegister;
|
typedef 0 RoundRegister;
|
typedef 1 TreeHeightRegister;
|
typedef 1 TreeHeightRegister;
|
typedef 2 LastCompressionRegister;
|
typedef 2 LastCompressionRegister;
|
typedef 3 PaddingBitsRegister;
|
typedef 3 PaddingBitsRegister;
|
typedef 4 KeyLengthRegister;
|
typedef 4 KeyLengthRegister;
|
typedef 5 DigestLengthRegister;
|
typedef 5 DigestLengthRegister;
|
typedef 6 CompressionFunctionStatus;
|
typedef 6 CompressionFunctionStatus;
|
typedef 7 KeyRegisterBase;
|
typedef 7 KeyRegisterBase;
|
typedef TAdd#(ControlRegisters,KeyRegisters) IdentifierRegisterBase;
|
typedef TAdd#(ControlRegisters,KeyRegisters) IdentifierRegisterBase;
|
typedef TAdd#(ControlRegisters, TAdd#(KeyRegisters,IdentifierRegisters)) SourceRegisterBase;
|
typedef TAdd#(ControlRegisters, TAdd#(KeyRegisters,IdentifierRegisters)) SourceRegisterBase;
|
typedef TAdd#(TAdd#(ControlRegisters,IdentifierRegisters), TAdd#(KeyRegisters,SourceRegisters)) DestinationRegisterBase;
|
typedef TAdd#(TAdd#(ControlRegisters,IdentifierRegisters), TAdd#(KeyRegisters,SourceRegisters)) DestinationRegisterBase;
|
typedef TAdd#(IdentifierRegisters,TAdd#(TAdd#(ControlRegisters,DestinationRegisters), TAdd#(KeyRegisters,SourceRegisters))) TotalRegisters;
|
typedef TAdd#(IdentifierRegisters,TAdd#(TAdd#(ControlRegisters,DestinationRegisters), TAdd#(KeyRegisters,SourceRegisters))) TotalRegisters;
|
|
|
typedef TDiv#(TMul#(SizeOf#(BusWord),BeatsPerBurst), SizeOf#(MD6Word)) MD6WordsPerBurst;
|
typedef TDiv#(TMul#(SizeOf#(BusWord),BeatsPerBurst), SizeOf#(MD6Word)) MD6WordsPerBurst;
|
|
|
typedef 32'hC0000 MD6CommunicationConstant;
|
typedef 32'hC0000 MD6CommunicationConstant;
|
|
|
typedef struct {
|
typedef struct {
|
Command command;
|
Command command;
|
RegisterTag regTag;
|
RegisterTag regTag;
|
Bit#(InterfaceRegister) payload;
|
Bit#(InterfaceRegister) payload;
|
} IOCommand deriving (Bits,Eq);
|
} IOCommand deriving (Bits,Eq);
|
|
|
typedef enum {
|
typedef enum {
|
Idle,
|
Idle,
|
Load
|
Load
|
} LoadState deriving (Bits,Eq);
|
} LoadState deriving (Bits,Eq);
|
|
|
typedef enum {
|
typedef enum {
|
Idle,
|
Idle,
|
Store
|
Store
|
} StoreState deriving (Bits,Eq);
|
} StoreState deriving (Bits,Eq);
|
|
|
|
|
(*synthesize*)
|
(*synthesize*)
|
module mkCompressionFunction64 (CompressionFunction#(64));
|
module mkCompressionFunction64 (CompressionFunction#(64));
|
let m <- mkMult16CompressionFunction;
|
let m <- mkMult16CompressionFunction;
|
return m;
|
return m;
|
endmodule
|
endmodule
|
|
|
(*synthesize*)
|
(*synthesize*)
|
module mkCompressionFunction48 (CompressionFunction#(48));
|
module mkCompressionFunction48 (CompressionFunction#(48));
|
let m <- mkMult16CompressionFunction;
|
let m <- mkMult16CompressionFunction;
|
return m;
|
return m;
|
endmodule
|
endmodule
|
|
|
(*synthesize*)
|
(*synthesize*)
|
module mkCompressionFunction32 (CompressionFunction#(32));
|
module mkCompressionFunction32 (CompressionFunction#(32));
|
let m <- mkMult16CompressionFunction;
|
let m <- mkMult16CompressionFunction;
|
return m;
|
return m;
|
endmodule
|
endmodule
|
|
|
(*synthesize*)
|
(*synthesize*)
|
module mkCompressionFunction16 (CompressionFunction#(16));
|
module mkCompressionFunction16 (CompressionFunction#(16));
|
let m <- mkSimpleCompressionFunction;
|
let m <- mkSimpleCompressionFunction;
|
return m;
|
return m;
|
endmodule
|
endmodule
|
|
|
(*synthesize*)
|
(*synthesize*)
|
module mkCompressionFunction8 (CompressionFunction#(8));
|
module mkCompressionFunction8 (CompressionFunction#(8));
|
let m <- mkSimpleCompressionFunction;
|
let m <- mkSimpleCompressionFunction;
|
return m;
|
return m;
|
endmodule
|
endmodule
|
|
|
(*synthesize*)
|
(*synthesize*)
|
module mkCompressionFunction4 (CompressionFunction#(4));
|
module mkCompressionFunction4 (CompressionFunction#(4));
|
let m <- mkSimpleCompressionFunction;
|
let m <- mkSimpleCompressionFunction;
|
return m;
|
return m;
|
endmodule
|
endmodule
|
|
|
(*synthesize*)
|
(*synthesize*)
|
module mkCompressionFunction2 (CompressionFunction#(2));
|
module mkCompressionFunction2 (CompressionFunction#(2));
|
let m <- mkSimpleCompressionFunction;
|
let m <- mkSimpleCompressionFunction;
|
return m;
|
return m;
|
endmodule
|
endmodule
|
|
|
(*synthesize*)
|
(*synthesize*)
|
module mkCompressionFunction1 (CompressionFunction#(1));
|
module mkCompressionFunction1 (CompressionFunction#(1));
|
let m <- mkSimpleCompressionFunction;
|
let m <- mkSimpleCompressionFunction;
|
return m;
|
return m;
|
endmodule
|
endmodule
|
|
|
|
|
module mkMD6Engine (MD6Engine);
|
module mkMD6Engine (MD6Engine);
|
Feeder feeder <- mkBRAMFeeder();
|
Feeder feeder <- mkBRAMFeeder();
|
PLBMaster plbMaster <- mkPLBMaster;
|
PLBMaster plbMaster <- mkPLBMaster;
|
CompressionFunction#(4) compressionFunction <- mkSimpleCompressionFunction;
|
CompressionFunction#(4) compressionFunction <- mkSimpleCompressionFunction;
|
FIFO#(PPCMessage) outputFIFO <- mkFIFO;
|
FIFO#(PPCMessage) outputFIFO <- mkFIFO;
|
Vector#(TotalRegisters, Reg#(Bit#(InterfaceRegister))) interfaceRegisters <-
|
Vector#(TotalRegisters, Reg#(Bit#(InterfaceRegister))) interfaceRegisters <-
|
replicateM(mkReg(0));
|
replicateM(mkReg(0));
|
|
|
|
|
// Hook Control, PLBMaster and MD6 engine components together.
|
// Hook Control, PLBMaster and MD6 engine components together.
|
// This solution WILL NOT WORK for multiple Compression functions
|
// This solution WILL NOT WORK for multiple Compression functions
|
mkConnection(plbMaster.wordInput.put, compressionFunction.outputWord);
|
mkConnection(plbMaster.wordInput.put, compressionFunction.outputWord);
|
mkConnection(compressionFunction.inputWord,plbMaster.wordOutput.get);
|
mkConnection(compressionFunction.inputWord,plbMaster.wordOutput.get);
|
mkConnection(feeder.ppcMessageInput.put,(fifoToGet(outputFIFO)).get);
|
mkConnection(feeder.ppcMessageInput.put,(fifoToGet(outputFIFO)).get);
|
|
|
Reg#(Bit#(TAdd#(1,TDiv#(MD6_b,MD6WordsPerBurst)))) loadCount <- mkReg(0);
|
Reg#(Bit#(TAdd#(1,TDiv#(MD6_b,MD6WordsPerBurst)))) loadCount <- mkReg(0);
|
|
|
Reg#(Bit#(TAdd#(1,TDiv#(MD6_c,MD6WordsPerBurst)))) storeCount <- mkReg(0);
|
Reg#(Bit#(TAdd#(1,TDiv#(MD6_c,MD6WordsPerBurst)))) storeCount <- mkReg(0);
|
|
|
Reg#(LoadState) loadState <- mkReg(Idle);
|
Reg#(LoadState) loadState <- mkReg(Idle);
|
|
|
Reg#(StoreState) storeState <- mkReg(Idle);
|
Reg#(StoreState) storeState <- mkReg(Idle);
|
|
|
FIFO#(IOCommand) incomingCommands <- mkFIFO;
|
FIFO#(IOCommand) incomingCommands <- mkFIFO;
|
|
|
function IOCommand extractIOCommand(PPCMessage ppcMessage);
|
function IOCommand extractIOCommand(PPCMessage ppcMessage);
|
IOCommand command = IOCommand {command: unpack(ppcMessage[31]),
|
IOCommand command = IOCommand {command: unpack(ppcMessage[31]),
|
regTag: ppcMessage[30:16],
|
regTag: ppcMessage[30:16],
|
payload: ppcMessage[15:0]};
|
payload: ppcMessage[15:0]};
|
return command;
|
return command;
|
endfunction
|
endfunction
|
|
|
// This function may require its own unit test
|
// This function may require its own unit test
|
// It should convert interface words to MD6 Words
|
// It should convert interface words to MD6 Words
|
function Vector#(length,MD6Word) convertWords(
|
function Vector#(length,MD6Word) convertWords(
|
Vector#(TMul#(length,TDiv#(MD6_WordWidth,InterfaceRegister)),Bit#(InterfaceRegister)) inVector);
|
Vector#(TMul#(length,TDiv#(MD6_WordWidth,InterfaceRegister)),Bit#(InterfaceRegister)) inVector);
|
Vector#(length,MD6Word) outVector = newVector;
|
Vector#(length,MD6Word) outVector = newVector;
|
for(Integer totalNumber = 0;
|
for(Integer totalNumber = 0;
|
totalNumber < valueof(length);
|
totalNumber < valueof(length);
|
totalNumber = totalNumber + 1)
|
totalNumber = totalNumber + 1)
|
begin
|
begin
|
Vector#(TDiv#(MD6_WordWidth,InterfaceRegister),Bit#(InterfaceRegister)) wordVector = newVector;
|
Vector#(TDiv#(MD6_WordWidth,InterfaceRegister),Bit#(InterfaceRegister)) wordVector = newVector;
|
for(Integer wordsInMD6Word = 0;
|
for(Integer wordsInMD6Word = 0;
|
wordsInMD6Word < valueof(TDiv#(MD6_WordWidth,InterfaceRegister));
|
wordsInMD6Word < valueof(TDiv#(MD6_WordWidth,InterfaceRegister));
|
wordsInMD6Word = wordsInMD6Word + 1)
|
wordsInMD6Word = wordsInMD6Word + 1)
|
begin
|
begin
|
wordVector[wordsInMD6Word] = inVector[totalNumber*valueof(TDiv#(MD6_WordWidth,InterfaceRegister))
|
wordVector[wordsInMD6Word] = inVector[totalNumber*valueof(TDiv#(MD6_WordWidth,InterfaceRegister))
|
+wordsInMD6Word];
|
+wordsInMD6Word];
|
end
|
end
|
outVector[totalNumber] = unpack(pack(wordVector)); // is this sane?
|
outVector[totalNumber] = unpack(pack(wordVector)); // is this sane?
|
end
|
end
|
return outVector;
|
return outVector;
|
endfunction
|
endfunction
|
|
|
rule getCommand;
|
rule getCommand;
|
PPCMessage msg <- feeder.ppcMessageOutput.get;
|
PPCMessage msg <- feeder.ppcMessageOutput.get;
|
IOCommand command = extractIOCommand(msg);
|
IOCommand command = extractIOCommand(msg);
|
incomingCommands.enq(command);
|
incomingCommands.enq(command);
|
endrule
|
endrule
|
|
|
// Writing to the CompressionFunctionStatus means kickoff a compression operation
|
// Writing to the CompressionFunctionStatus means kickoff a compression operation
|
// Reading from it will grab the current status of the Compression Engine
|
// Reading from it will grab the current status of the Compression Engine
|
|
|
rule processWrite(incomingCommands.first.command == Write);
|
rule processWrite(incomingCommands.first.command == Write);
|
incomingCommands.deq;
|
incomingCommands.deq;
|
|
|
if(fromInteger(valueof(CompressionFunctionStatus)) == incomingCommands.first.regTag)
|
if(fromInteger(valueof(CompressionFunctionStatus)) == incomingCommands.first.regTag)
|
begin
|
begin
|
// we can leave this unguarded because the properties of the compression function
|
// we can leave this unguarded because the properties of the compression function
|
// will prevent doing nasty things like confusing the order of memory accesses.
|
// will prevent doing nasty things like confusing the order of memory accesses.
|
let controlWord = makeControlWord(truncate(interfaceRegisters[valueof(RoundRegister)]),
|
let controlWord = makeControlWord(truncate(interfaceRegisters[valueof(RoundRegister)]),
|
truncate(interfaceRegisters[valueof(TreeHeightRegister)]),
|
truncate(interfaceRegisters[valueof(TreeHeightRegister)]),
|
truncate(interfaceRegisters[valueof(LastCompressionRegister)]),
|
truncate(interfaceRegisters[valueof(LastCompressionRegister)]),
|
truncate(interfaceRegisters[valueof(PaddingBitsRegister)]),
|
truncate(interfaceRegisters[valueof(PaddingBitsRegister)]),
|
truncate(interfaceRegisters[valueof(KeyLengthRegister)]),
|
truncate(interfaceRegisters[valueof(KeyLengthRegister)]),
|
truncate(interfaceRegisters[valueof(DigestLengthRegister)]));
|
truncate(interfaceRegisters[valueof(DigestLengthRegister)]));
|
|
|
compressionFunction.start(convertWords(takeAt(valueof(IdentifierRegisterBase),readVReg(interfaceRegisters))),
|
compressionFunction.start(convertWords(takeAt(valueof(IdentifierRegisterBase),readVReg(interfaceRegisters))),
|
controlWord,
|
controlWord,
|
convertWords(takeAt(valueof(KeyRegisterBase),readVReg(interfaceRegisters))));
|
convertWords(takeAt(valueof(KeyRegisterBase),readVReg(interfaceRegisters))));
|
loadState <= Load;
|
loadState <= Load;
|
loadCount <= 0;
|
loadCount <= 0;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
interfaceRegisters[incomingCommands.first.regTag] <= incomingCommands.first.payload;
|
interfaceRegisters[incomingCommands.first.regTag] <= incomingCommands.first.payload;
|
end
|
end
|
endrule
|
endrule
|
|
|
rule processRead(incomingCommands.first.command == Read);
|
rule processRead(incomingCommands.first.command == Read);
|
incomingCommands.deq;
|
incomingCommands.deq;
|
|
|
// This is a bit ugly, and we should possibly fix it.
|
// This is a bit ugly, and we should possibly fix it.
|
if(fromInteger(valueof(CompressionFunctionStatus)) == incomingCommands.first.regTag)
|
if(fromInteger(valueof(CompressionFunctionStatus)) == incomingCommands.first.regTag)
|
begin
|
begin
|
outputFIFO.enq(fromInteger(valueof(MD6CommunicationConstant))|zeroExtend(compressionFunction.status));
|
outputFIFO.enq(fromInteger(valueof(MD6CommunicationConstant))|zeroExtend(compressionFunction.status));
|
end
|
end
|
else
|
else
|
begin
|
begin
|
outputFIFO.enq(fromInteger(valueof(MD6CommunicationConstant))|zeroExtend((interfaceRegisters[incomingCommands.first.regTag])));
|
outputFIFO.enq(fromInteger(valueof(MD6CommunicationConstant))|zeroExtend((interfaceRegisters[incomingCommands.first.regTag])));
|
end
|
end
|
|
|
endrule
|
endrule
|
|
|
|
|
|
|
|
|
// Probably should handle non-fitting burst sizes. But, don't have to
|
// Probably should handle non-fitting burst sizes. But, don't have to
|
// for now.
|
// for now.
|
if(valueof(TotalRegisters) != 47)
|
if(valueof(TotalRegisters) != 47)
|
begin
|
begin
|
error("Total Registers: %d\n",valueof(TotalRegisters));
|
error("Total Registers: %d\n",valueof(TotalRegisters));
|
end
|
end
|
|
|
if(valueof(MD6_b)%valueof(MD6WordsPerBurst) != 0)
|
if(valueof(MD6_b)%valueof(MD6WordsPerBurst) != 0)
|
begin
|
begin
|
error("MD6_b:%d not divisible by MD6WordsPerBurst:%d",valueof(MD6_b), valueof(MD6WordsPerBurst));
|
error("MD6_b:%d not divisible by MD6WordsPerBurst:%d",valueof(MD6_b), valueof(MD6WordsPerBurst));
|
end
|
end
|
|
|
if(valueof(MD6_c)%valueof(MD6WordsPerBurst) != 0)
|
if(valueof(MD6_c)%valueof(MD6WordsPerBurst) != 0)
|
begin
|
begin
|
error("MD6_c:%d not divisible by MD6WordsPerBurst:%d",valueof(MD6_c), valueof(MD6WordsPerBurst));
|
error("MD6_c:%d not divisible by MD6WordsPerBurst:%d",valueof(MD6_c), valueof(MD6WordsPerBurst));
|
end
|
end
|
|
|
rule issueLoads(loadState == Load);
|
rule issueLoads(loadState == Load);
|
if(loadCount + 1 == fromInteger(valueof(MD6_b)/valueof(MD6WordsPerBurst)))
|
if(loadCount + 1 == fromInteger(valueof(MD6_b)/valueof(MD6WordsPerBurst)))
|
begin
|
begin
|
loadState <= Idle;
|
loadState <= Idle;
|
storeState <= Store;
|
storeState <= Store;
|
storeCount <= 0;
|
storeCount <= 0;
|
end
|
end
|
loadCount <= loadCount + 1;
|
loadCount <= loadCount + 1;
|
BlockAddr refAddr = truncateLSB({interfaceRegisters[valueof(SourceRegisterBase)+1],
|
BlockAddr refAddr = truncateLSB({interfaceRegisters[valueof(SourceRegisterBase)+1],
|
interfaceRegisters[valueof(SourceRegisterBase)]})
|
interfaceRegisters[valueof(SourceRegisterBase)]})
|
+ (zeroExtend(loadCount) << (valueof(TLog#(WordsPerBurst))));
|
+ (zeroExtend(loadCount) << (valueof(TLog#(WordsPerBurst))));
|
|
|
plbMaster.plbMasterCommandInput.put(tagged LoadPage refAddr);
|
plbMaster.plbMasterCommandInput.put(tagged LoadPage refAddr);
|
endrule
|
endrule
|
|
|
|
|
|
|
rule issueStores(storeState == Store);
|
rule issueStores(storeState == Store);
|
if(storeCount + 1 == fromInteger(valueof(MD6_c)/valueof(MD6WordsPerBurst)))
|
if(storeCount + 1 == fromInteger(valueof(MD6_c)/valueof(MD6WordsPerBurst)))
|
begin
|
begin
|
storeState <= Idle;
|
storeState <= Idle;
|
end
|
end
|
storeCount <= storeCount + 1;
|
storeCount <= storeCount + 1;
|
|
|
BlockAddr refAddr = truncateLSB({interfaceRegisters[valueof(DestinationRegisterBase)+1],
|
BlockAddr refAddr = truncateLSB({interfaceRegisters[valueof(DestinationRegisterBase)+1],
|
interfaceRegisters[valueof(DestinationRegisterBase)]})
|
interfaceRegisters[valueof(DestinationRegisterBase)]})
|
+ (zeroExtend(storeCount) << (valueof(TLog#(WordsPerBurst))));
|
+ (zeroExtend(storeCount) << (valueof(TLog#(WordsPerBurst))));
|
|
|
plbMaster.plbMasterCommandInput.put(tagged StorePage refAddr);
|
plbMaster.plbMasterCommandInput.put(tagged StorePage refAddr);
|
endrule
|
endrule
|
|
|
interface plbMasterWires = plbMaster.plbMasterWires;
|
interface plbMasterWires = plbMaster.plbMasterWires;
|
interface bramInitiatorWires = feeder.bramInitiatorWires;
|
interface bramInitiatorWires = feeder.bramInitiatorWires;
|
|
|
|
|