|
Message
From: cvs at opencores.org<cvs@o...>
Date: Mon Jun 30 18:02:12 CEST 2008
Subject: [cvs-checkins] MODIFIED: cryptosorter ...
Date: 00/08/06 30:18:02 Added: cryptosorter/memocodeDesignContest2008/xup/Common Common.bsv DebugFlags.bsv Interfaces.bsv Parameters.bsv Types.bsv Utils.bsv Log: Initial checkin with actual source Revision Changes Path 1.1 cryptosorter/memocodeDesignContest2008/xup/Common/Common.bsv http://www.opencores.org/cvsweb.shtml/cryptosorter/memocodeDesignContest2008/xup/Common/Common.bsv?rev=1.1&content-type=text/x-cvsweb-markup Index: Common.bsv =================================================================== /* Copyright (c) 2007 MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Author: Kermin Fleming */ import Parameters::*; import Types::*; import Interfaces::*; import Utils::*; import DebugFlags::*; 1.1 cryptosorter/memocodeDesignContest2008/xup/Common/DebugFlags.bsv http://www.opencores.org/cvsweb.shtml/cryptosorter/memocodeDesignContest2008/xup/Common/DebugFlags.bsv?rev=1.1&content-type=text/x-cvsweb-markup Index: DebugFlags.bsv =================================================================== /* Copyright (c) 2007 MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Author: Kermin Fleming */ // This file contains debug flags for the various system modules. You should // turn these off when you check in files // Instruction Translation Flags Bool controllerDebug = True; Bool feederDebug = False; Bool plbMasterDebug = True; Bool memorySwitchDebug = False; Bool ppcDebug = False; Bool externalMemoryDebug = False; function Action debug(Bool b, Action a); action if (b) a;
endaction
endfunction
1.1 cryptosorter/memocodeDesignContest2008/xup/Common/Interfaces.bsv
http://www.opencores.org/cvsweb.shtml/cryptosorter/memocodeDesignContest2008/xup/Common/Interfaces.bsv?rev=1.1&content-type=text/x-cvsweb-markup
Index: Interfaces.bsv
===================================================================
/*
Copyright (c) 2007 MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Author: Kermin Fleming
*/
// Global imports
import GetPut::*;
import FIFO::*;
import Vector::*;
// Local imports
import Types::*;
import Parameters::*;
import PLBMasterWires::*;
import BRAMInitiatorWires::*;
import Memocode08Types::*;
/* This is the top level interface. We only have wires going to the
plb bus and the DSOCM which implements the BRAM interface.
*/
interface PLBMaster;
interface Put#(Record) wordInput;
interface Get#(Record) wordOutput;
interface Put#(PLBMasterCommand) plbMasterCommandInput;
interface PLBMasterWires plbMasterWires;
endinterface
1.1 cryptosorter/memocodeDesignContest2008/xup/Common/Parameters.bsv
http://www.opencores.org/cvsweb.shtml/cryptosorter/memocodeDesignContest2008/xup/Common/Parameters.bsv?rev=1.1&content-type=text/x-cvsweb-markup
Index: Parameters.bsv
===================================================================
/*
Copyright (c) 2007 MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Author: Kermin Fleming
*/
import Memocode08Types::*;
typedef 1 FunctionalUnitNumber;
typedef TLog#(FunctionalUnitNumber) LogFunctionalUnitNumber;
typedef Bit#(LogFunctionalUnitNumber) FunctionalUnitAddr;
typedef Bit#(FunctionalUnitNumber) FunctionalUnitMask;
typedef 32 BlockSize; // Words per burst (4*RecordsPerMemRequest)
//typedef 16 BlockSize;
typedef 32 WordWidth;
typedef 64 DoubleWordWidth;
typedef Bit#(64) BusWord;
typedef TDiv#(TMul#(BlockSize,WordWidth),RecordWidth) RecordsPerBlock;
typedef TDiv#(RecordWidth,WordWidth) WordsPerRecord;
typedef TDiv#(RecordWidth,DoubleWordWidth) DoubleWordsPerRecord;
typedef TLog#(BlockSize) LogBlockSize;
typedef TMul#(BlockSize, BlockSize) BlockElements;
typedef TLog#(TMul#(BlockSize, BlockSize)) LogBlockElements;
typedef 1024 MaxBlockSize;
typedef TAdd#(TLog#(MaxBlockSize), 2) LogRowSize;
typedef 32 PLBAddrSize;
typedef Bit#(PLBAddrSize) PLBAddr;
typedef 2 WordsPerBeat; // PLB bandwidth
//typedef TDiv#(BlockSize,WordsPerBeat) BeatsPerBlock;
typedef 16 BurstSize; // number of beats per burst
typedef 16 BeatsPerBurst;
typedef Bit#(30) BlockAddr;
1.1 cryptosorter/memocodeDesignContest2008/xup/Common/Types.bsv
http://www.opencores.org/cvsweb.shtml/cryptosorter/memocodeDesignContest2008/xup/Common/Types.bsv?rev=1.1&content-type=text/x-cvsweb-markup
Index: Types.bsv
===================================================================
/*
Copyright (c) 2007 MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Author: Kermin Fleming
*/
// Global imports
import GetPut::*;
import FIFO::*;
import Vector::*;
import Parameters::*;
// Typdefs for various bit types
typedef Bit#(32) ComplexWord;
typedef enum
{
A,
B,
C
} MatrixRegister
deriving(Bits,Eq);
typedef enum
{
Multiply,
Zero,
MultiplyAddAccumulate,
MultiplySubAccumulate,
AddAccumulate,
SubAccumulate
}
FunctionalUnitOp
deriving(Bits,Eq);
typedef union tagged
{
Bit#(LogRowSize) RowSize;
BlockAddr LoadPage;
BlockAddr StorePage;
}
PLBMasterCommand
deriving(Bits,Eq);
typedef union tagged
{
FunctionalUnitAddr StoreFromFU;
FunctionalUnitMask LoadToFUs;
}
MemorySwitchCommand
deriving(Bits,Eq);
typedef struct
{
FunctionalUnitAddr fuSrc;
MatrixRegister regSrc;
FunctionalUnitMask fuDests;
MatrixRegister regDest;
}
FUNetworkCommand
deriving(Bits,Eq);
typedef union tagged
{
MatrixRegister ForwardSrc;
MatrixRegister ForwardDest;
MatrixRegister Load;
MatrixRegister Store;
FunctionalUnitOp Op;
} FunctionalUnitCommand
deriving(Bits,Eq);
typedef union tagged
{
struct{
FunctionalUnitMask fus;
FunctionalUnitOp op;
} ArithmeticInstruction;
struct
{
FunctionalUnitMask fus;
MatrixRegister regName;
PLBAddr addr;
} LoadInstruction;
struct
{
FunctionalUnitAddr fu;
MatrixRegister regName;
PLBAddr addr;
} StoreInstruction;
struct
{
FunctionalUnitAddr fuSrc;
MatrixRegister regSrc;
FunctionalUnitMask fuDests;
MatrixRegister regDest;
} ForwardInstruction;
Bit#(LogRowSize) SetRowSizeInstruction;
} Instruction
deriving(Bits,Eq);
/*
Template for cases on Instruction.
case (ins) matches
tagged ArithmeticInstruction .i: //{.fus, .op}
tagged LoadInstruction .i: //{.fus, .regName, .addr}
tagged StoreInstruction .i: //{.fus, .regName, .addr}
tagged ForwardInstruction .i: //{.fuSrc, .regSrc, .fuDests, .regDest}
tagged SetRowSizeInstruction .sz:
endcase
*/
//A message to the PPC
typedef Bit#(32) PPCMessage;
typedef enum{
FI_InIdle,
FI_InStartCheckRead,
FI_InStartRead,
FI_InStartTake,
FI_OutStartCheckWrite,
FI_OutStartWrite,
FI_OutStartPush,
FI_CheckLoadStore,
FI_Load,
FI_LoadTake,
FI_Store,
FI_StorePush,
FI_command
} FeederState deriving(Eq,Bits);
function Maybe#(BlockAddr) translateLoad(Instruction inst);
if(inst matches tagged LoadInstruction .l)
begin
return tagged Valid (truncate(l.addr));
end
else
begin
return tagged Invalid;
end
endfunction
function Maybe#(BlockAddr) translateStore(Instruction inst);
if(inst matches tagged StoreInstruction .l)
begin
return tagged Valid (truncate(l.addr));
end
else
begin
return tagged Invalid;
end
endfunction
function Maybe#(BlockAddr) translateRowSize(Instruction inst);
if(inst matches tagged SetRowSizeInstruction .sz)
begin
return tagged Valid (1 << sz);
end
else
begin
return tagged Invalid;
end
endfunction
1.1 cryptosorter/memocodeDesignContest2008/xup/Common/Utils.bsv
http://www.opencores.org/cvsweb.shtml/cryptosorter/memocodeDesignContest2008/xup/Common/Utils.bsv?rev=1.1&content-type=text/x-cvsweb-markup
Index: Utils.bsv
===================================================================
/*
Copyright (c) 2007 MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Author: Kermin Fleming
*/
import Parameters::*;
import Types::*;
import Interfaces::*;
function String showReg (MatrixRegister r);
case (r)
A: return "A";
B: return "B";
C: return "C";
endcase
endfunction
function String showFunctionalUnitOp(FunctionalUnitOp f);
case (f)
Multiply: return "Multiply";
Zero: return "Zero";
MultiplyAddAccumulate: return "MultiplyAddAccumulate";
MultiplySubAccumulate:return "MultiplySubAccumulate";
AddAccumulate: return "AddAccumulate";
SubAccumulate:return "SubAccumulate";
endcase
endfunction
function Action showInst (Instruction ins);
case (ins) matches
tagged ArithmeticInstruction .i:
$display("ARITH %0b %0b", i.fus, i.op);
tagged LoadInstruction .i:
$display("LOAD %0b %s 0x%0h", i.fus, showReg(i.regName), i.addr);
tagged StoreInstruction .i:
$display("STORE %0b %s 0x%0h", i.fu, showReg(i.regName), i.addr);
tagged ForwardInstruction .i:
$display("FORWARD %0b %s %0b %s", i.fuSrc, showReg(i.regSrc), i.fuDests, showReg(i.regDest));
tagged SetRowSizeInstruction .sz:
$display("SetRowSizeInstruction 0x%0h", sz);
endcase
endfunction
function Action displayInst (Instruction ins);
case (ins) matches
tagged ArithmeticInstruction .i:
$display("ARITH %0b %0b", i.fus, i.op);
tagged LoadInstruction .i:
$display("LOAD %0b %s 0x%0h", i.fus, showReg(i.regName), i.addr);
tagged StoreInstruction .i:
$display("STORE %0b %s 0x%0h", i.fu, showReg(i.regName), i.addr);
tagged ForwardInstruction .i:
$display("FORWARD %0b %s %0b %s", i.fuSrc, showReg(i.regSrc), i.fuDests, showReg(i.regDest));
tagged SetRowSizeInstruction .sz:
$display("SetRowSizeInstruction 0x%0h", sz);
endcase
endfunction
function Tuple2#(Bit#(32), Bit#(32)) splitInst(Instruction i) = split(zeroExtend(pack(i)));
function Instruction fuseInst(Bit#(32) x ,Bit#(32) y) = unpack(truncate({x, y}));
function Bit#(m) oneHot(Bit#(n) x) provisos (Log#(m, n));
Bit#(m) tmp = 0;
tmp[x] = 1;
return tmp;
endfunction
//This can be mapped across Vectors, etc.
function FUNetworkLink getLink(FunctionalUnit#(t) f);
return f.link;
endfunction
|
 |