packages feed

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

- BlackBox:
    name: Clash.Sized.Internal.Index.pack#
    kind: Expression
    type: 'pack# :: Index
      n -> BitVector (CLog 2 n)'
    template: std_logic_vector(~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: unsigned(~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]~ELSEtrue~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]~ELSEfalse~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]~ELSEfalse~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]~ELSEtrue~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]~ELSEfalse~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]~ELSEtrue~FI
- BlackBox:
    name: Clash.Sized.Internal.Index.maxBound#
    kind: Expression
    type: 'maxBound# :: KnownNat
      n => Index n'
    template: to_unsigned(~LIT[0]-1,~SIZE[~TYPO])
    workInfo: Constant
- BlackBox:
    name: Clash.Sized.Internal.Index.toEnum#
    kind: Expression
    type: 'toEnum# :: KnownNat
      n => Int -> Index n'
    template: resize(unsigned(std_logic_vector(~ARG[1])),~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.fromEnum#
    kind: Expression
    type: 'fromEnum# :: KnownNat
      n => Index n -> Int'
    template: ~IF~SIZE[~TYP[1]]~THENsigned(std_logic_vector(resize(~ARG[1],~SIZE[~TYPO])))~ELSEto_signed(0,~SIZE[~TYPO])~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: resize(~ARG[1] * ~ARG[2], ~SIZE[~TYPO])
- BlackBox:
    name: Clash.Sized.Internal.Index.fromInteger#
    kind: Expression
    type: 'fromInteger# ::
      KnownNat n => Integer -> Index n'
    template: resize(unsigned(std_logic_vector(~ARG[1])),~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.plus#
    kind: Expression
    type: Index m -> Index
      n -> Index (m + n - 1)
    template: resize(~ARG[0],~SIZE[~TYPO]) + resize(~ARG[1],~SIZE[~TYPO])
- BlackBox:
    name: Clash.Sized.Internal.Index.minus#
    kind: Expression
    type: Index m -> Index
      n -> Index (m + n - 1)
    template: resize(~ARG[0],~SIZE[~TYPO]) - resize(~ARG[1],~SIZE[~TYPO])
- BlackBox:
    name: Clash.Sized.Internal.Index.times#
    kind: Expression
    type: Index m -> Index
      n -> Index (((m-1) * (n-1)) + 1)
    template: resize(~ARG[0] * ~ARG[1],~SIZE[~TYPO])
- BlackBox:
    name: Clash.Sized.Internal.Index.rem#
    kind: Declaration
    type: 'rem# :: Index n
      -> Index n -> Index n'
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBoxHaskell:
    name: Clash.Sized.Internal.Index.toInteger#
    templateFunction: Clash.Primitives.Sized.ToInteger.indexToIntegerVHDL
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.resize#
    kind: Expression
    type: 'resize# :: KnownNat
      m => Index n -> Index m'
    template: ~IF~SIZE[~TYP[1]]~THENresize(~ARG[1],~SIZE[~TYPO])~ELSEunsigned'(~SIZE[~TYPO]-1
      downto 0 => '0')~FI
    workInfo: Never
- BlackBox:
    name: Clash.Sized.Internal.Index.quot#
    kind: Declaration
    type: 'quot# :: Index
      n -> Index n -> Index n'
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;