[ { "BlackBox" :
    { "name"      : "Clash.Sized.Internal.Index.pack#"
    , "workInfo"  : "Never"
    , "kind"      : "Expression"
    , "type"      : "pack# :: Index n -> BitVector (CLog 2 n)"
    , "template"  : "~ARG[0]"
    }
  }
, { "BlackBox" :
    { "name"      : "Clash.Sized.Internal.Index.unpack#"
    , "workInfo"  : "Never"
    , "kind"      : "Expression"
    , "type"      : "unpack# :: (KnownNat n, 1 <= n) => BitVector (CLog 2 n) -> Index n"
    , "template"  : "~ARG[2]"
    }
  }
, { "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#"
    , "workInfo"  : "Constant"
    , "kind"      : "Expression"
    , "type"      : "maxBound# :: KnownNat n => Index n"
    , "template"  : "~ARG[0]-~SIZE[~TYPO]'d1"
    }
  }
, { "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#"
    , "workInfo"  : "Never"
    , "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"
    }
  }
, { "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#"
    , "workInfo"  : "Never"
    , "templateFunction" : "Clash.Primitives.Sized.ToInteger.indexToIntegerVerilog"
    }
  }
, { "BlackBox" :
    { "name"      : "Clash.Sized.Internal.Index.resize#"
    , "workInfo"  : "Never"
    , "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"
    }
  }
]