clash-lib-1.10.0: prims/commonverilog/Clash_Sized_Internal_Signed.primitives.yaml
- BlackBox:
name: Clash.Sized.Internal.Signed.eq#
kind: Expression
type: 'eq# :: Signed n
-> Signed n -> Bool'
template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] == ~ARG[1]~ELSE1'b1~FI
- BlackBox:
name: Clash.Sized.Internal.Signed.neq#
kind: Expression
type: 'neq# :: Signed
n -> Signed n -> Bool'
template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] != ~ARG[1]~ELSE1'b0~FI
- BlackBox:
name: Clash.Sized.Internal.Signed.lt#
kind: Expression
type: 'lt# :: Signed n
-> Signed n -> Bool'
template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] < ~ARG[1]~ELSE1'b0~FI
- BlackBox:
name: Clash.Sized.Internal.Signed.ge#
kind: Expression
type: 'ge# :: Signed n
-> Signed n -> Bool'
template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] >= ~ARG[1]~ELSE1'b1~FI
- BlackBox:
name: Clash.Sized.Internal.Signed.gt#
kind: Expression
type: 'gt# :: Signed n
-> Signed n -> Bool'
template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] > ~ARG[1]~ELSE1'b0~FI
- BlackBox:
name: Clash.Sized.Internal.Signed.le#
kind: Expression
type: 'le# :: Signed n
-> Signed n -> Bool'
template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] <= ~ARG[1]~ELSE1'b1~FI
- BlackBoxHaskell:
name: Clash.Sized.Internal.Signed.toInteger#
templateFunction: Clash.Primitives.Sized.ToInteger.signedToIntegerVerilog
workInfo: Never
- BlackBox:
name: Clash.Sized.Internal.Signed.fromEnum#
kind: Expression
type: 'fromEnum# :: KnownNat
n => Signed n -> Int'
template: ~IF~SIZE[~TYP[1]]~THEN~IF~CMPLE[~SIZE[~TYPO]][~SIZE[~TYP[1]]]~THEN$signed(~VAR[i][1][0+:~SIZE[~TYPO]])~ELSE$signed({{(~SIZE[~TYPO]-~SIZE[~TYP[1]])
{~VAR[i][1][~SIZE[~TYP[1]]-1]}},~VAR[i][1]})~FI~ELSE~SIZE[~TYPO]'sd0~FI
workInfo: Never
- BlackBox:
name: Clash.Sized.Internal.Signed.size#
kind: Expression
type: 'size# :: KnownNat
n => Signed n -> Int'
template: ~SIZE[~TYPO]'sd~LIT[0]
workInfo: Constant
- BlackBox:
name: Clash.Sized.Internal.Signed.pack#
kind: Expression
type: 'pack# :: KnownNat
n => Signed n -> BitVector n'
template: $unsigned(~ARG[1])
workInfo: Never
- BlackBox:
name: Clash.Sized.Internal.Signed.unpack#
kind: Expression
type: 'unpack# :: KnownNat
n => BitVector n -> Signed n'
template: $signed(~ARG[1])
workInfo: Never
- BlackBox:
name: Clash.Sized.Internal.Signed.minBound#
comment: Generates incorrect SV for n=0
kind: Expression
type: 'minBound# :: KnownNat
n => Signed n'
template: $signed({1'b1, {(~LIT[0]-1) {1'b0}}})
workInfo: Constant
- BlackBox:
name: Clash.Sized.Internal.Signed.maxBound#
comment: Generates incorrect SV for n=0
kind: Expression
type: 'maxBound# :: KnownNat
n => Signed n'
template: $signed({1'b0, {(~LIT[0]-1) {1'b1}}})
workInfo: Constant
- BlackBox:
name: Clash.Sized.Internal.Signed.*#
kind: Expression
type: '(*#) :: KnownNat
n => Signed n -> Signed n -> Signed n'
template: ~ARG[1] * ~ARG[2]
- BlackBox:
name: Clash.Sized.Internal.Signed.negate#
kind: Expression
type: 'negate# :: KnownNat
n => Signed n -> Signed n'
template: -~ARG[1]
- BlackBox:
name: Clash.Sized.Internal.Signed.abs#
kind: Expression
type: 'abs# :: KnownNat
n => Signed n -> Signed n'
template: '(~ARG[1] < ~LIT[0]''sd0) ? -~ARG[1] : ~ARG[1]'
- BlackBox:
name: Clash.Sized.Internal.Signed.fromInteger#
kind: Expression
type: 'fromInteger# ::
KnownNat n => Integer -> Signed (n :: Nat)'
template: >-
~IF~CMPLE[~SIZE[~TYPO]][~SIZE[~TYP[1]]]
~THEN$signed(~VAR[i][1][0+:~SIZE[~TYPO]])
~ELSE$signed({{(~SIZE[~TYPO]-~SIZE[~TYP[1]]){~VAR[i][1][~SIZE[~TYP[1]]-1]}},~VAR[i][1]})
~FI
workInfo: Never
- BlackBox:
name: Clash.Sized.Internal.Signed.toEnum#
kind: Expression
type: 'toEnum# :: KnownNat
n => Int -> Signed n'
template: ~IF~CMPLE[~SIZE[~TYPO]][~SIZE[~TYP[1]]]~THEN$signed(~VAR[i][1][0+:~SIZE[~TYPO]])~ELSE$signed({{(~SIZE[~TYPO]-~SIZE[~TYP[1]])
{~VAR[i][1][~SIZE[~TYP[1]]-1]}},~VAR[i][1]})~FI
workInfo: Never
- BlackBox:
name: Clash.Sized.Internal.Signed.plus#
kind: Declaration
type: 'plus# :: Signed
m -> Signed n -> Signed (1 + Max m n)'
template: assign ~RESULT = ~IF~AND[~SIZE[~TYP[0]],~SIZE[~TYP[1]]]~THEN~ARG[0]
+ ~ARG[1]~ELSE~IF~SIZE[~TYP[0]]~THEN~ARG[0]~ELSE~ARG[1]~FI~FI;
- BlackBox:
name: Clash.Sized.Internal.Signed.minus#
kind: Declaration
type: 'minus# :: Signed
m -> Signed n -> Signed (1 + Max m n)'
template: assign ~RESULT = ~IF~AND[~SIZE[~TYP[0]],~SIZE[~TYP[1]]]~THEN ~ARG[0]
- ~ARG[1]~ELSE~IF~SIZE[~TYP[0]]~THEN ~ARG[0]~ELSE - ~ARG[1] ~FI~FI;
- BlackBox:
name: Clash.Sized.Internal.Signed.times#
kind: Declaration
type: 'times# :: Signed
m -> Signed n -> Signed (m + n)'
template: assign ~RESULT = ~IF~AND[~SIZE[~TYP[0]],~SIZE[~TYP[1]]]~THEN~ARG[0]
* ~ARG[1]~ELSE~SIZE[~TYPO]'d0~FI;
- BlackBox:
name: Clash.Sized.Internal.Signed.rem#
kind: Expression
type: 'rem# :: Signed
n -> Signed n -> Signed n'
template: ~ARG[0] % ~ARG[1]
- BlackBox:
name: Clash.Sized.Internal.Signed.and#
kind: Expression
type: 'and# :: KnownNat
n => Signed n -> Signed n -> Signed n'
template: ~ARG[1] & ~ARG[2]
- BlackBox:
name: Clash.Sized.Internal.Signed.or#
kind: Expression
type: 'or# :: KnownNat
n => Signed n -> Signed n -> Signed n'
template: ~ARG[1] | ~ARG[2]
- BlackBox:
name: Clash.Sized.Internal.Signed.xor#
kind: Expression
type: 'xor# :: KnownNat
n => Signed n -> Signed n -> Signed n'
template: ~ARG[1] ^ ~ARG[2]
- BlackBox:
name: Clash.Sized.Internal.Signed.complement#
kind: Expression
type: 'complement# ::
KnownNat n => Signed n -> Signed n'
template: ~ ~ARG[1]
- BlackBox:
name: Clash.Sized.Internal.Signed.shiftL#
kind: Expression
type: 'shiftL# :: KnownNat
n => Signed n -> Int -> Signed n'
template: ~ARG[1] <<< ~ARG[2]
- BlackBox:
name: Clash.Sized.Internal.Signed.shiftR#
kind: Expression
type: 'shiftR# :: KnownNat
n => Signed n -> Int -> Signed n'
template: ~ARG[1] >>> ~ARG[2]
- BlackBox:
name: Clash.Sized.Internal.Signed.truncateB#
kind: Expression
type: 'truncateB# :: KnownNat
m => Signed (n + m) -> Signed m'
template: $signed(~VAR[s][1][0+:~SIZE[~TYPO]])
workInfo: Never
- BlackBox:
name: Clash.Sized.Internal.Signed.resize#
kind: Expression
type: 'resize# :: (KnownNat
n, KnownNat m) => Signed n -> Signed m'
template: ~IF~SIZE[~TYP[2]]~THEN~IF~CMPLE[~SIZE[~TYPO]][~SIZE[~TYP[2]]]~THEN$signed({~VAR[s][2][~LIT[0]-1],~VAR[s][2][0+:(~SIZE[~TYPO]-1)]})~ELSE$signed({{(~SIZE[~TYPO]-~SIZE[~TYP[2]])
{~VAR[s][2][~LIT[0]-1]}},~VAR[s][2]})~FI~ELSE~SIZE[~TYPO]'sd0~FI
workInfo: Never
- BlackBox:
name: Clash.Sized.Internal.Signed.quot#
kind: Expression
type: 'quot# :: KnownNat
n => Signed n -> Signed n -> Signed n'
template: ~ARG[1] / ~ARG[2]