packages feed

clash-lib-1.6.0: prims/commonverilog/Clash_Sized_Internal_Index.primitives.yaml

- BlackBox:
    name: Clash.Sized.Internal.Index.pack#
    kind: Expression
    type: 'pack# :: Index
      n -> BitVector (CLog 2 n)'
    template: ~ARG[0]
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.unpack#
    kind: Expression
    type: 'unpack# :: (KnownNat
      n, 1 <= n) => BitVector (CLog 2 n) -> Index n'
    template: ~ARG[2]
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.eq#
    kind: Expression
    type: 'eq# :: Index n
      -> Index n -> Bool'
    template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] == ~ARG[1]~ELSE1'b1~FI
- BlackBox:
    name: Clash.Sized.Internal.Index.neq#
    kind: Expression
    type: 'neq# :: Index n
      -> Index n -> Bool'
    template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] != ~ARG[1]~ELSE1'b0~FI
- BlackBox:
    name: Clash.Sized.Internal.Index.lt#
    kind: Expression
    type: 'lt# :: Index n
      -> Index n -> Bool'
    template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] < ~ARG[1]~ELSE1'b0~FI
- BlackBox:
    name: Clash.Sized.Internal.Index.ge#
    kind: Expression
    type: 'ge# :: Index n
      -> Index n -> Bool'
    template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] >= ~ARG[1]~ELSE1'b1~FI
- BlackBox:
    name: Clash.Sized.Internal.Index.gt#
    kind: Expression
    type: 'gt# :: Index n
      -> Index n -> Bool'
    template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] > ~ARG[1]~ELSE1'b0~FI
- BlackBox:
    name: Clash.Sized.Internal.Index.le#
    kind: Expression
    type: 'le# :: Index n
      -> Index n -> Bool'
    template: ~IF~SIZE[~TYP[0]]~THEN~ARG[0] <= ~ARG[1]~ELSE1'b1~FI
- BlackBox:
    name: Clash.Sized.Internal.Index.maxBound#
    kind: Expression
    type: 'maxBound# :: KnownNat
      n => Index n'
    template: ~ARG[0]-~SIZE[~TYPO]'d1
    workInfo: Constant
- BlackBox:
    name: Clash.Sized.Internal.Index.fromEnum#
    kind: Expression
    type: 'fromEnum# :: KnownNat
      n => Index n -> Int'
    template: ~IF~SIZE[~TYP[1]]~THEN~IF~CMPLE[~SIZE[~TYPO]][~SIZE[~TYP[1]]]~THEN$unsigned(~VAR[i][1][0+:~SIZE[~TYPO]])~ELSE$unsigned({{(~SIZE[~TYPO]-~SIZE[~TYP[1]])
      {1'b0}},~VAR[i][1]})~FI~ELSE~SIZE[~TYPO]'sd0~FI
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.toEnum#
    kind: Expression
    type: 'toEnum# :: KnownNat
      n => Int -> Index n'
    template: ~IF~CMPLE[~SIZE[~TYPO]][~SIZE[~TYP[1]]]~THEN$unsigned(~VAR[i][1][0+:~SIZE[~TYPO]])~ELSE$unsigned({{(~SIZE[~TYPO]-~SIZE[~TYP[1]])
      {1'b0}},~VAR[i][1]})~FI
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.+#
    kind: Expression
    type: '(+#) :: KnownNat
      n => Index n -> Index n -> Index n'
    template: ~ARG[1] + ~ARG[2]
- BlackBox:
    name: Clash.Sized.Internal.Index.-#
    kind: Expression
    type: '(-#) :: KnownNat
      n => Index n -> Index n -> Index n'
    template: ~ARG[1] - ~ARG[2]
- BlackBox:
    name: Clash.Sized.Internal.Index.*#
    kind: Expression
    type: '(*#) :: KnownNat
      n => Index n -> Index n -> Index n'
    template: ~ARG[1] * ~ARG[2]
- BlackBox:
    name: Clash.Sized.Internal.Index.fromInteger#
    kind: Expression
    type: 'fromInteger# ::
      KnownNat n => Integer -> Index n'
    template: ~IF~CMPLE[~SIZE[~TYPO]][~SIZE[~TYP[1]]]~THEN$unsigned(~VAR[i][1][0+:~SIZE[~TYPO]])~ELSE$unsigned({{(~SIZE[~TYPO]-~SIZE[~TYP[1]])
      {1'b0}},~VAR[i][1]})~FI
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.plus#
    kind: Declaration
    type: Index m -> Index
      n -> Index (m + n - 1)
    template: assign ~RESULT = ~ARG[0] + ~ARG[1];
- BlackBox:
    name: Clash.Sized.Internal.Index.minus#
    kind: Declaration
    type: Index m -> Index
      n -> Index (m + n - 1)
    template: assign ~RESULT = ~ARG[0] - ~ARG[1];
- BlackBox:
    name: Clash.Sized.Internal.Index.times#
    kind: Declaration
    type: Index m -> Index
      n -> Index (((m-1) * (n-1)) + 1)
    template: assign ~RESULT = ~ARG[0] * ~ARG[1];
- BlackBox:
    name: Clash.Sized.Internal.Index.rem#
    kind: Expression
    type: 'rem# :: Index n
      -> Index n -> Index n'
    template: ~ARG[0] % ~ARG[1]
- BlackBoxHaskell:
    name: Clash.Sized.Internal.Index.toInteger#
    templateFunction: Clash.Primitives.Sized.ToInteger.indexToIntegerVerilog
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.resize#
    kind: Expression
    type: 'resize# :: KnownNat
      m => Index n -> Index m'
    template: ~IF~SIZE[~TYP[1]]~THEN~IF~CMPLE[~SIZE[~TYPO]][~SIZE[~TYP[1]]]~THEN~VAR[bv][1][0+:~SIZE[~TYPO]]~ELSE{{(~SIZE[~TYPO]-~SIZE[~TYP[1]])
      {1'b0}},~ARG[1]}~FI~ELSE~SIZE[~TYPO]'d0~FI
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.quot#
    kind: Expression
    type: 'quot# :: Index
      n -> Index n -> Index n'
    template: ~ARG[0] / ~ARG[1]