Documentation ¶
Index ¶
- func CreateFile(FolderPath string, FileName string, TemplateFile string, Data interface{})
- func FileNameGen(EntityName string) (VHDLFile string, TestFile string)
- func MaxSwitchingTestData(Mult VHDLEntityMultiplier, FolderPath string, N uint)
- func N(stop uint) (stream chan uint)
- func NormalTestData(Mult VHDLEntityMultiplier, FolderPath string, N uint)
- func OverflowCheck16bit(input uint) (output uint, overflow bool)
- func OverflowCheck8bit(input uint) (output uint, overflow bool)
- func OverflowCheckGeneric(input uint, n uint) (output uint, overflow bool)
- func RandomNormalInput(size int) int
- func UniformTestData(Mult VHDLEntityMultiplier, FolderPath string, N uint)
- type Correlator
- type EntityData
- type ExternalMult
- func (ext *ExternalMult) AddVHDLEntity(Entity VHDLEntity)
- func (ext *ExternalMult) AverageRelativeError() float64
- func (ext *ExternalMult) GenerateTestData(FolderPath string)
- func (ext *ExternalMult) GenerateVHDL(FolderPath string)
- func (ext *ExternalMult) GenerateVHDLEntityArray() []VHDLEntity
- func (ext *ExternalMult) MeanAbsoluteError() float64
- func (ext *ExternalMult) MeanAbsoluteErrorNormalDist(N int) float64
- func (ext *ExternalMult) Overflow() bool
- func (ext *ExternalMult) ParseXSIMOutput(FolderPath string)
- func (ext *ExternalMult) ReturnData() *EntityData
- func (ext *ExternalMult) ReturnVal(a, b uint) uint
- func (ext *ExternalMult) String() string
- type LUT2D
- func (m *LUT2D) GenerateTestData(FolderPath string)
- func (m *LUT2D) GenerateVHDL(FolderPath string)
- func (m *LUT2D) GenerateVHDLEntityArray() []VHDLEntity
- func (m *LUT2D) MeanAbsoluteError() float64
- func (m *LUT2D) Overflow() bool
- func (m *LUT2D) Print()
- func (m *LUT2D) ReturnData() *EntityData
- func (m *LUT2D) ReturnVal(a, b uint) uint
- func (m *LUT2D) String() string
- type MAC
- func (mac *MAC) GenerateTestData(FolderPath string)
- func (mac *MAC) GenerateVHDL(FolderPath string)
- func (mac *MAC) GenerateVHDLEntityArray() []VHDLEntity
- func (mac *MAC) MeanAbsoluteError() float64
- func (mac *MAC) Overflow() bool
- func (mac *MAC) ResetVal()
- func (mac *MAC) ReturnData() *EntityData
- func (mac *MAC) ReturnVal(a uint, b uint) uint
- func (mac *MAC) String() string
- type Modification
- type Multiplier
- type Recursive4
- func (r4 *Recursive4) AverageRelativeError() float64
- func (r4 *Recursive4) GenerateTestData(FolderPath string)
- func (r4 *Recursive4) GenerateVHDL(FolderPath string)
- func (r4 *Recursive4) GenerateVHDLEntityArray() []VHDLEntity
- func (r4 *Recursive4) MeanAbsoluteError() float64
- func (r4 *Recursive4) MeanAbsoluteErrorNormalDist(N int) float64
- func (r4 *Recursive4) Overflow() bool
- func (r4 *Recursive4) ReturnData() *EntityData
- func (r4 *Recursive4) ReturnVal(a uint, b uint) uint
- func (r4 *Recursive4) String() string
- type Recursive8
- func (r8 *Recursive8) AverageRelativeError() float64
- func (r8 *Recursive8) GenerateTestData(FolderPath string)
- func (r8 *Recursive8) GenerateVHDL(FolderPath string)
- func (r8 *Recursive8) GenerateVHDLEntityArray() []VHDLEntity
- func (r8 *Recursive8) MeanAbsoluteError() float64
- func (r8 *Recursive8) Overflow() bool
- func (r8 *Recursive8) ReturnData() *EntityData
- func (r8 *Recursive8) ReturnVal(a uint, b uint) uint
- func (r8 *Recursive8) String() string
- type Scaler
- func (scl *Scaler) GenerateTestData(FolderPath string)
- func (scl *Scaler) GenerateVHDL(FolderPath string)
- func (scl *Scaler) GenerateVHDLEntityArray() []VHDLEntity
- func (scl *Scaler) MeanAbsoluteError() float64
- func (scl *Scaler) Overflow() bool
- func (scl *Scaler) ReturnData() *EntityData
- func (scl *Scaler) ReturnVal(a uint, b uint) uint
- func (scl *Scaler) SetMAC(b bool, OutputSize uint)
- func (scl *Scaler) String() string
- type UnsignedApproxMultiplyer
- type UnsignedNumericAccurateMAC
- func (mac *UnsignedNumericAccurateMAC) GenerateTestData(FolderPath string)
- func (mac *UnsignedNumericAccurateMAC) GenerateVHDL(FolderPath string)
- func (mac *UnsignedNumericAccurateMAC) GenerateVHDLEntityArray() []VHDLEntity
- func (mac *UnsignedNumericAccurateMAC) MeanAbsoluteError() float64
- func (mac *UnsignedNumericAccurateMAC) Overflow() bool
- func (mac *UnsignedNumericAccurateMAC) ResetVal()
- func (mac *UnsignedNumericAccurateMAC) ReturnData() *EntityData
- func (mac *UnsignedNumericAccurateMAC) ReturnVal(a uint, b uint) uint
- func (mac *UnsignedNumericAccurateMAC) String() string
- type UnsignedNumericAccurateMultiplyer
- func (m *UnsignedNumericAccurateMultiplyer) GenerateTestData(FolderPath string)
- func (m *UnsignedNumericAccurateMultiplyer) GenerateVHDL(FolderPath string)
- func (m *UnsignedNumericAccurateMultiplyer) GenerateVHDLEntityArray() []VHDLEntity
- func (m *UnsignedNumericAccurateMultiplyer) MeanAbsoluteError() float64
- func (m *UnsignedNumericAccurateMultiplyer) Overflow() bool
- func (m *UnsignedNumericAccurateMultiplyer) ReturnData() *EntityData
- func (m *UnsignedNumericAccurateMultiplyer) ReturnVal(a uint, b uint) uint
- func (m *UnsignedNumericAccurateMultiplyer) String() string
- type VHDLEntity
- type VHDLEntityMultiplier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFile ¶
CreateFile is a helper function used for the generation of VHDL templates TODO: Add funcmap support
func FileNameGen ¶
FileNameGen is a helper function, used to standardize filenames within VHDLEntity interfaces to avoid a bit of boilerplate code
func MaxSwitchingTestData ¶
func MaxSwitchingTestData(Mult VHDLEntityMultiplier, FolderPath string, N uint)
MaxSwitchingTestData creates testdata that should create the highest switching behaviour NOTE: This function has not been tested
func N ¶
N is a helper function used in templates to iterate from 0 to N-1 https://stackoverflow.com/questions/22713500/iterating-a-range-of-integers-in-go-templates If it works, it works. N 100 => Iters from 0 to 99(!)
func NormalTestData ¶
func NormalTestData(Mult VHDLEntityMultiplier, FolderPath string, N uint)
NormalTestData creates N random normal distributed Testdata for Mult, within Folderpath
func OverflowCheck16bit ¶
OverflowCheck16bit returns OverflowCheckGeneric(input, 16)
func OverflowCheck8bit ¶
OverflowCheck8bit returns OverflowCheckGeneric(input, 8)
func OverflowCheckGeneric ¶
OverflowCheckGeneric checks if an input value of uint would overflow in a smaller bit representation N. Output returns the output value after applying the smaller bit representation Overflow returns a boolean if overflow has occured, and thus output and input are not equal
func RandomNormalInput ¶
RandomNormalInput creates a random input value on basis of bitsize, according to the distributions described in the MACISH paper
func UniformTestData ¶
func UniformTestData(Mult VHDLEntityMultiplier, FolderPath string, N uint)
UniformTestData creates N random uniform Testdata for Mult, within Folderpath
Types ¶
type Correlator ¶
type Correlator struct { EntityName string BitSize uint OutputSize uint MACArray [4]VHDLEntity //Size of 4 VHDLFile string TestFile string }
Correlator is a non-finished struct implementing template "corrbehav.vhd" within the Approxy software
func NewCorrelator ¶
func NewCorrelator(EntityName string, MACArray [4]VHDLEntity) *Correlator
NewCorrelator returns a new correlator on basis of 4 Multiply-Accumulators as defined MACArray[0] = ReYReS MACArray[1] = ImYImS MACArray[2] = ReYImS MACArray[3] = ImYReS
func (*Correlator) GenerateTestData ¶
func (corr *Correlator) GenerateTestData(FolderPath string)
GenerateTestData creates a plaintext testdata file containing both inputs and the output in binary seperated by \t Not Implemented for CORRELATOR!
func (*Correlator) GenerateVHDL ¶
func (corr *Correlator) GenerateVHDL(FolderPath string)
GenerateVHDL creates the VHDL file in FolderPath
func (*Correlator) GenerateVHDLEntityArray ¶
func (corr *Correlator) GenerateVHDLEntityArray() []VHDLEntity
GenerateVHDLEntityArray creates an array of potentially multiple VHDLEntities, sorted by priority for synthesizing For example: Multiplier A uses a VHDL portmap for the smaller Multiplier B & C. B & C need to be synthesized first, hence A will be last in the array
func (*Correlator) ReturnData ¶
func (corr *Correlator) ReturnData() *EntityData
ReturnData returns a struct containing metadata of the correlator
func (*Correlator) String ¶
func (corr *Correlator) String() string
type EntityData ¶
type EntityData struct { EntityName string BitSize uint OutputSize uint VHDLFile string TestFile string }
EntityData encapsulates basic data for a VHDL structure
type ExternalMult ¶
type ExternalMult struct { EntityName string BitSize uint OutputSize uint VHDLFile string TestFile string TemplateFile string Behaviour [][]uint ExtraVHDLEntity []VHDLEntity }
ExternalMult is a struct that defines a Multiplier based on existing synthesizable VHDL files instead of VHDL templates. Templates for this model are stored in the folder template/external The Entity within the external synthesizable VHDL needs to be modified, info found in the wiki
func NewExternalMult ¶
func NewExternalMult(EntityName string, BitSize uint, Template string) *ExternalMult
NewExternalMult creates a new ExternalMult struct EntityName: Name of Entity BitSize: Bit-length of input Template: Filename of external template, ie. "mult_accurate.vhd"
func (*ExternalMult) AddVHDLEntity ¶
func (ext *ExternalMult) AddVHDLEntity(Entity VHDLEntity)
AddVHDLEntity is used when external templates require portmap and thus multiple VHDL files Create for each portmapped external VHDL file a new ExternalMult struct, and add according to synthesis priority
func (*ExternalMult) AverageRelativeError ¶
func (ext *ExternalMult) AverageRelativeError() float64
AverageRelativeError returns the Average Relative Error of the multiplier in float64
func (*ExternalMult) GenerateTestData ¶
func (ext *ExternalMult) GenerateTestData(FolderPath string)
GenerateTestData creates a plaintext testdata file containing both inputs and the output in binary seperated by \t WARNING: the testdata will be invalid if ParseXSIMOutput has not run yet
func (*ExternalMult) GenerateVHDL ¶
func (ext *ExternalMult) GenerateVHDL(FolderPath string)
GenerateVHDL creates the VHDL file in FolderPath
func (*ExternalMult) GenerateVHDLEntityArray ¶
func (ext *ExternalMult) GenerateVHDLEntityArray() []VHDLEntity
GenerateVHDLEntityArray creates an array of potentially multiple VHDLEntities, sorted by priority for synthesizing For example: Multiplier A uses a VHDL portmap for the smaller Multiplier B & C. B & C need to be synthesized first, hence A will be last in the array
func (*ExternalMult) MeanAbsoluteError ¶
func (ext *ExternalMult) MeanAbsoluteError() float64
MeanAbsoluteError returns the MeanAbsoluteError of the multiplier in float64, for a uniform distribution
func (*ExternalMult) MeanAbsoluteErrorNormalDist ¶
func (ext *ExternalMult) MeanAbsoluteErrorNormalDist(N int) float64
MeanAbsoluteErrorNormalDist returns the MeanAbsoluteError of the multiplier in float64, for a normal distribution N = the amount of random input/output combinations
func (*ExternalMult) Overflow ¶
func (ext *ExternalMult) Overflow() bool
Overflow returns a boolean for internal overflow, not supported for ExternalMult
func (*ExternalMult) ParseXSIMOutput ¶
func (ext *ExternalMult) ParseXSIMOutput(FolderPath string)
ParseXSIMOutput parses the output file of an XSIM simulation in FolderPath The XSIM simulation (done via the Vivado package) applies the whole range of inputs to the multiplier and exports output data The data is parsed via this function to build the model behaviour within the Behaviour [][]uint field
func (*ExternalMult) ReturnData ¶
func (ext *ExternalMult) ReturnData() *EntityData
ReturnData returns a struct containing metadata of the multiplier
func (*ExternalMult) ReturnVal ¶
func (ext *ExternalMult) ReturnVal(a, b uint) uint
ReturnVal returns the output of the multiplier
func (*ExternalMult) String ¶
func (ext *ExternalMult) String() string
type LUT2D ¶
type LUT2D struct { EntityName string BitSize uint OutputSize uint LUT [][]uint VHDLFile string TestFile string }
LUT2D defines a 2D LUT structure. Interface == VHDLEntity
func New2DUnsignedAcc ¶
New2DUnsignedAcc creates a 2D LUT structure, containing the LUT of an accurate Bitsize multiplyer.
func (*LUT2D) GenerateTestData ¶
GenerateTestData creates testing data in plain text. Two inputs and outputs, seperated by \t
func (*LUT2D) GenerateVHDL ¶
GenerateVHDL creates the VHDL file in FolderPath TODO: Make VHDLtoFile call the Generic function
func (*LUT2D) GenerateVHDLEntityArray ¶
func (m *LUT2D) GenerateVHDLEntityArray() []VHDLEntity
GenerateVHDLEntityArray creates an array of potentially multiple VHDLEntities, sorted by priority for synthesizing LUT2D returns a single entity
func (*LUT2D) MeanAbsoluteError ¶
MeanAbsoluteError returns the MeanAbsoluteError of the multiplier in float64
func (*LUT2D) ReturnData ¶
func (m *LUT2D) ReturnData() *EntityData
ReturnData returns a struct containing metadata of the multiplier
type MAC ¶
type MAC struct { EntityName string BitSize uint OutputSize uint Multiplier VHDLEntityMultiplier VHDLFile string TestFile string CurrentValue uint T uint MaximumValue uint }
MAC creates a Multiply-Accumulator on basis of a VHDLEntityMultiplier, the accumulation is accurate
func NewMAC ¶
func NewMAC(Multiplier VHDLEntityMultiplier, T uint) *MAC
NewMAC creates the MAC struct, on basis of Multiplier and T amount of guaranteed accumulations without overflow
func (*MAC) GenerateTestData ¶
GenerateTestData creates testing data in plain text. Two inputs and outputs, seperated by \t
func (*MAC) GenerateVHDL ¶
GenerateVHDL creates the VHDL file in FolderPath
func (*MAC) GenerateVHDLEntityArray ¶
func (mac *MAC) GenerateVHDLEntityArray() []VHDLEntity
GenerateVHDLEntityArray creates an array of potentially multiple VHDLEntities, sorted by priority for synthesizing For example: Multiplier A uses a VHDL portmap for the smaller Multiplier B & C. B & C need to be synthesized first, hence A will be last in the array
func (*MAC) MeanAbsoluteError ¶
MeanAbsoluteError returns the MeanAbsoluteError of the multiplier in float64 FIX ME: NOT IMPLEMENTED
func (*MAC) Overflow ¶
Overflow returns a boolean if any internal overflow has occured FIX ME: NOT IMPLEMENTED
func (*MAC) ReturnData ¶
func (mac *MAC) ReturnData() *EntityData
ReturnData returns a struct containing metadata of the multiplier
type Modification ¶
Modification is struct containing a single modification to a multiplier. For Example, we want 3x3=7 instead of 3x3=9, this makes the modification A=3, B=3, O=7
type Multiplier ¶
type Multiplier interface { ReturnVal(uint, uint) uint Overflow() bool MeanAbsoluteError() float64 }
Multiplier describes an interface for generic Multipliers
type Recursive4 ¶
type Recursive4 struct { EntityName string BitSize uint //Default to 4 OutputSize uint //Default to 8 LUTArray [4]VHDLEntityMultiplier //Size of 4 VHDLFile string TestFile string OverflowError bool }
Recursive4 creates a 4-bit recursive multiplier on basis of four 2-bit VHDLEntityMultipliers, addition is accurate.
func NewRecursive4 ¶
func NewRecursive4(EntityName string, LUTArray [4]VHDLEntityMultiplier) *Recursive4
NewRecursive4 creates a Recursive4 struct LUTArray[0] = AH*BH LUTArray[1] = AH*BL LUTArray[2] = AL*BH LUTArray[3] = AL*BL
func (*Recursive4) AverageRelativeError ¶
func (r4 *Recursive4) AverageRelativeError() float64
AverageRelativeError returns the AverageRelativeError of the multiplier in float64
func (*Recursive4) GenerateTestData ¶
func (r4 *Recursive4) GenerateTestData(FolderPath string)
GenerateTestData creates a plaintext testdata file containing both inputs and the output in binary seperated by \t
func (*Recursive4) GenerateVHDL ¶
func (r4 *Recursive4) GenerateVHDL(FolderPath string)
GenerateVHDL creates the VHDL files in FolderPath
func (*Recursive4) GenerateVHDLEntityArray ¶
func (r4 *Recursive4) GenerateVHDLEntityArray() []VHDLEntity
GenerateVHDLEntityArray creates an array of potentially multiple VHDLEntities, sorted by priority for synthesizing For example: Multiplier A uses a VHDL portmap for the smaller Multiplier B & C. B & C need to be synthesized first, hence A will be last in the array
func (*Recursive4) MeanAbsoluteError ¶
func (r4 *Recursive4) MeanAbsoluteError() float64
MeanAbsoluteError returns the MeanAbsoluteError of the multiplier in float64
func (*Recursive4) MeanAbsoluteErrorNormalDist ¶
func (r4 *Recursive4) MeanAbsoluteErrorNormalDist(N int) float64
MeanAbsoluteErrorNormalDist returns the MeanAbsoluteError of the multiplier in float64, using N random normal distributed inputs
func (*Recursive4) Overflow ¶
func (r4 *Recursive4) Overflow() bool
Overflow returns a boolean if any internal overflow has occured
func (*Recursive4) ReturnData ¶
func (r4 *Recursive4) ReturnData() *EntityData
ReturnData returns a struct containing metadata of the multiplier
func (*Recursive4) ReturnVal ¶
func (r4 *Recursive4) ReturnVal(a uint, b uint) uint
ReturnVal returns the output of the multiplier
func (*Recursive4) String ¶
func (r4 *Recursive4) String() string
type Recursive8 ¶
type Recursive8 struct { EntityName string BitSize uint //Default to 8 OutputSize uint //Default to 16 Rec4Array [4]VHDLEntityMultiplier //Size of 4 VHDLFile string TestFile string OverflowError bool }
Recursive8 creates a 8-bit recursive multiplier on basis of four 4-bit VHDLEntityMultipliers, addition is accurate.
func NewRecursive8 ¶
func NewRecursive8(EntityName string, Rec4Array [4]VHDLEntityMultiplier) *Recursive8
NewRecursive8 creates a Recursive8 struct LUTArray[0] = AH*BH LUTArray[1] = AH*BL LUTArray[2] = AL*BH LUTArray[3] = AL*BL
func (*Recursive8) AverageRelativeError ¶
func (r8 *Recursive8) AverageRelativeError() float64
AverageRelativeError returns the AverageRelativeError of the multiplier in float64
func (*Recursive8) GenerateTestData ¶
func (r8 *Recursive8) GenerateTestData(FolderPath string)
GenerateTestData creates a plaintext testdata file containing both inputs and the output in binary seperated by \t
func (*Recursive8) GenerateVHDL ¶
func (r8 *Recursive8) GenerateVHDL(FolderPath string)
GenerateVHDL creates the VHDL file in FolderPath
func (*Recursive8) GenerateVHDLEntityArray ¶
func (r8 *Recursive8) GenerateVHDLEntityArray() []VHDLEntity
GenerateVHDLEntityArray creates an array of potentially multiple VHDLEntities, sorted by priority for synthesizing For example: Multiplier A uses a VHDL portmap for the smaller Multiplier B & C. B & C need to be synthesized first, hence A will be last in the array
func (*Recursive8) MeanAbsoluteError ¶
func (r8 *Recursive8) MeanAbsoluteError() float64
MeanAbsoluteError returns the MeanAbsoluteError of the multiplier in float64
func (*Recursive8) Overflow ¶
func (r8 *Recursive8) Overflow() bool
Overflow returns a boolean if any internal overflow has occured
func (*Recursive8) ReturnData ¶
func (r8 *Recursive8) ReturnData() *EntityData
ReturnData returns a struct containing metadata of the multiplier
func (*Recursive8) ReturnVal ¶
func (r8 *Recursive8) ReturnVal(a uint, b uint) uint
ReturnVal returns the output of the multiplier
func (*Recursive8) String ¶
func (r8 *Recursive8) String() string
type Scaler ¶
type Scaler struct { Entity VHDLEntityMultiplier LUTName string EntityName string BitSize uint ScaleN uint VHDLFile string TestFile string MAC bool OutputSize uint }
Scaler creates a linear scaling VHDL topfile for multipliers on basis of template "scaler.vhd" Note that synthesis has to be done OOC (Out-of-Context) or all multipliers besides one get optimised away
func New2DScaler ¶
func New2DScaler(Entity VHDLEntityMultiplier, N uint) *Scaler
New2DScaler creates a new Scaler struct
func (*Scaler) GenerateTestData ¶
GenerateTestData creates a plaintext testdata file containing both inputs and the output in binary seperated by \t Outputs simply the testdata of Multiplier that is being scaled
func (*Scaler) GenerateVHDL ¶
GenerateVHDL creates the VHDL files in FolderPath
func (*Scaler) GenerateVHDLEntityArray ¶
func (scl *Scaler) GenerateVHDLEntityArray() []VHDLEntity
GenerateVHDLEntityArray creates an array of potentially multiple VHDLEntities, sorted by priority for synthesizing For example: Multiplier A uses a VHDL portmap for the smaller Multiplier B & C. B & C need to be synthesized first, hence A will be last in the array
func (*Scaler) MeanAbsoluteError ¶
MeanAbsoluteError is not supported
func (*Scaler) ReturnData ¶
func (scl *Scaler) ReturnData() *EntityData
ReturnData returns a struct containing metadata of the multiplier
type UnsignedApproxMultiplyer ¶
type UnsignedApproxMultiplyer struct { LUT2D *LUT2D Mods []Modification }
UnsignedApproxMultiplyer creates an Approximate Multiplier on basis of the Accurate LUT2D struct, by enabling to add modification to it. This struct is simply an extension of the original LUT2D to make it easier to create approximate multiplier structures Template is "multbehav.vhd" as defined in LUT2D.go
func M1 ¶
func M1() *UnsignedApproxMultiplyer
M1 creates a 2-bit UnsignedApproxMultiplyer on basis of LUT2D Added Modifications: 3x3=7
func M2 ¶
func M2() *UnsignedApproxMultiplyer
M2 creates a 2-bit UnsignedApproxMultiplyer on basis of LUT2D Added Modifications: 1x1=0 1x3=2 3x1=2
func M3 ¶
func M3() *UnsignedApproxMultiplyer
M3 creates a 2-bit UnsignedApproxMultiplyer on basis of LUT2D 3x3=11
func M4 ¶
func M4() *UnsignedApproxMultiplyer
M4 creates a 2-bit UnsignedApproxMultiplyer on basis of LUT2D 3x3=5
func NewUnsignedApprox ¶
func NewUnsignedApprox(EntityName string, BitSize uint) *UnsignedApproxMultiplyer
NewUnsignedApprox creates a UnsignedApproxMultiplayer based upon a 2D LUT structure Using New2DUnsignedAcc to create an accurate multiplyer, but adds the option to add modification Modification are used to change values within the 2D LUT
func (*UnsignedApproxMultiplyer) AddModification ¶
func (m *UnsignedApproxMultiplyer) AddModification(mod Modification)
AddModification adds a modification to UnsignedApproxMultiplyer
func (*UnsignedApproxMultiplyer) ExecModifications ¶
func (m *UnsignedApproxMultiplyer) ExecModifications()
ExecModifications executes all added modifications to the internal LUT2D structure Warning: this is final
type UnsignedNumericAccurateMAC ¶
type UnsignedNumericAccurateMAC struct { EntityName string BitSize uint OutputSize uint VHDLFile string TestFile string CurrentValue uint T uint MaximumValue uint }
UnsignedNumericAccurateMAC is an Accurate Multiply-Accumulator on basis of template "macaccurate.vhd"
func NewUnsignedAccurateMAC ¶
func NewUnsignedAccurateMAC(BitSize uint, T uint) *UnsignedNumericAccurateMAC
NewUnsignedAccurateMAC creates the struct NewUnsignedAccurateMAC BitSize: Bit-length of Multiplier inputs T: N-amount of Accumulation guaranteed before overflow
func (*UnsignedNumericAccurateMAC) GenerateTestData ¶
func (mac *UnsignedNumericAccurateMAC) GenerateTestData(FolderPath string)
GenerateTestData creates MAC testing data in plain text. Two inputs and outputs, seperated by \t Note that MAC testing data is different, instead of applying an exhaustive test over the full range on inputs, inputs are kept static and overflow behaviour is verified
func (*UnsignedNumericAccurateMAC) GenerateVHDL ¶
func (mac *UnsignedNumericAccurateMAC) GenerateVHDL(FolderPath string)
GenerateVHDL creates the VHDL file in FolderPath
func (*UnsignedNumericAccurateMAC) GenerateVHDLEntityArray ¶
func (mac *UnsignedNumericAccurateMAC) GenerateVHDLEntityArray() []VHDLEntity
GenerateVHDLEntityArray creates an array of potentially multiple VHDLEntities, sorted by priority for synthesizing For example: Multiplier A uses a VHDL portmap for the smaller Multiplier B & C. B & C need to be synthesized first, hence A will be last in the array
func (*UnsignedNumericAccurateMAC) MeanAbsoluteError ¶
func (mac *UnsignedNumericAccurateMAC) MeanAbsoluteError() float64
MeanAbsoluteError returns the MeanAbsoluteError of the multiplier in float64 FIX ME: NOT IMPLEMENTED
func (*UnsignedNumericAccurateMAC) Overflow ¶
func (mac *UnsignedNumericAccurateMAC) Overflow() bool
Overflow returns a boolean if any internal overflow has occured FIX ME: NOT IMPLEMENTED
func (*UnsignedNumericAccurateMAC) ResetVal ¶
func (mac *UnsignedNumericAccurateMAC) ResetVal()
ResetVal resets the accumulator to 0
func (*UnsignedNumericAccurateMAC) ReturnData ¶
func (mac *UnsignedNumericAccurateMAC) ReturnData() *EntityData
ReturnData returns a struct containing metadata of the multiplier
func (*UnsignedNumericAccurateMAC) ReturnVal ¶
func (mac *UnsignedNumericAccurateMAC) ReturnVal(a uint, b uint) uint
ReturnVal outputs the current value of the Multiply-Accumulator on basis of input A and B
func (*UnsignedNumericAccurateMAC) String ¶
func (mac *UnsignedNumericAccurateMAC) String() string
type UnsignedNumericAccurateMultiplyer ¶
type UnsignedNumericAccurateMultiplyer struct { EntityName string BitSize uint VHDLFile string TestFile string }
UnsignedNumericAccurateMultiplyer defines a multiplyer based upon 'accuratebehav.vhd', this is a BitSize A*B=prod multiplyer, using the IEEE Numeric lib The struct is implemented as a VHDLEntity Interface
func NewAccurateNumMultiplyer ¶
func NewAccurateNumMultiplyer(EntityName string, BitSize uint) *UnsignedNumericAccurateMultiplyer
NewAccurateNumMultiplyer creates the struct UnsignedNumericAccurateMultiplyer EntityName: Name of Entity BitSize: Bit-length of Multiplier inputs
func (*UnsignedNumericAccurateMultiplyer) GenerateTestData ¶
func (m *UnsignedNumericAccurateMultiplyer) GenerateTestData(FolderPath string)
GenerateTestData creates a plaintext testdata file containing both inputs and the output in binary seperated by \t GenerateTestData uses the function from New2DUnsignedAcc, since their behaviour is identical.
func (*UnsignedNumericAccurateMultiplyer) GenerateVHDL ¶
func (m *UnsignedNumericAccurateMultiplyer) GenerateVHDL(FolderPath string)
GenerateVHDL creates the VHDL file in FolderPath
func (*UnsignedNumericAccurateMultiplyer) GenerateVHDLEntityArray ¶
func (m *UnsignedNumericAccurateMultiplyer) GenerateVHDLEntityArray() []VHDLEntity
GenerateVHDLEntityArray creates an array of potentially multiple VHDLEntities, sorted by priority for synthesizing For example: Multiplier A uses a VHDL portmap for the smaller Multiplier B & C. B & C need to be synthesized first, hence A will be last in the array
func (*UnsignedNumericAccurateMultiplyer) MeanAbsoluteError ¶
func (m *UnsignedNumericAccurateMultiplyer) MeanAbsoluteError() float64
MeanAbsoluteError returns the MeanAbsoluteError of the multiplier in float64
func (*UnsignedNumericAccurateMultiplyer) Overflow ¶
func (m *UnsignedNumericAccurateMultiplyer) Overflow() bool
Overflow returns a boolean if any internal overflow has occured This Multiplier is accurate, hence no overflow
func (*UnsignedNumericAccurateMultiplyer) ReturnData ¶
func (m *UnsignedNumericAccurateMultiplyer) ReturnData() *EntityData
ReturnData returns a struct containing metadata of the multiplier
func (*UnsignedNumericAccurateMultiplyer) ReturnVal ¶
func (m *UnsignedNumericAccurateMultiplyer) ReturnVal(a uint, b uint) uint
ReturnVal returns the output of the multiplier This multiplier is accurate
func (*UnsignedNumericAccurateMultiplyer) String ¶
func (m *UnsignedNumericAccurateMultiplyer) String() string
type VHDLEntity ¶
type VHDLEntity interface { ReturnData() *EntityData GenerateVHDL(string) GenerateTestData(string) GenerateVHDLEntityArray() []VHDLEntity String() string //MSB -> LSB }
VHDLEntity describes an interface for testable and synthesizable VHDL structures
func RemoveDuplicate ¶
func RemoveDuplicate(Array []VHDLEntity) []VHDLEntity
RemoveDuplicate is an helper function that removes duplicate VHDLEntity entries from an []VHDLEntity array
type VHDLEntityMultiplier ¶
type VHDLEntityMultiplier interface { VHDLEntity Multiplier }
VHDLEntityMultiplier is an interface that both implements the functions for VHDLEntity and the Multiplier methods