clash-lib-1.2.0: prims/vhdl/Clash_Sized_Internal_Signed.json
[ { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.size#"
, "workInfo" : "Constant"
, "kind" : "Expression"
, "type" : "size# :: KnownNat n => Signed n -> Int"
, "template" : "to_signed(~LIT[0],~SIZE[~TYPO])"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.pack#"
, "workInfo" : "Never"
, "kind" : "Expression"
, "type" : "pack# :: KnownNat n => Signed n -> BitVector n"
, "template" : "std_logic_vector(~ARG[1])"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.unpack#"
, "workInfo" : "Never"
, "kind" : "Expression"
, "type" : "unpack# :: KnownNat n => BitVector n -> Signed n"
, "template" : "signed(~ARG[1])"
}
}
, { "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]~ELSEtrue~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]~ELSEfalse~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]~ELSEfalse~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]~ELSEtrue~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]~ELSEfalse~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]~ELSEtrue~FI"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.minBound#"
, "workInfo" : "Constant"
, "kind" : "Expression"
, "type" : "minBound# :: KnownNat n => Signed n"
, "comment" : "the quantification with signed gives the array an ascending index"
, "template" : "~IF~SIZE[~TYPO]~THENsigned'(0 => '1', 1 to ~LIT[0]-1 => '0')~ELSEsigned'(1 downto 0 => '0')~FI"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.maxBound#"
, "workInfo" : "Constant"
, "kind" : "Expression"
, "type" : "maxBound# :: KnownNat n => Signed n"
, "comment" : "the quantification with signed gives the array an ascending index"
, "template" : "~IF~SIZE[~TYPO]~THENsigned'(0 => '0', 1 to ~LIT[0]-1 => '1')~ELSEsigned'(1 downto 0 => '0')~FI"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.*#"
, "kind" : "Expression"
, "type" : "(*#) :: KnownNat n => Signed n -> Signed n -> Signed n"
, "template" : "resize(~ARG[1] * ~ARG[2], ~LIT[0])"
}
}
, { "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" : "abs ~ARG[1]"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.fromInteger#"
, "workInfo" : "Never"
, "kind" : "Expression"
, "type" : "fromInteger# :: KnownNat n => Integer -> Signed (n :: Nat)"
, "template" : "resize(~ARG[1],~LIT[0])"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.plus#"
, "kind" : "Expression"
, "type" : "plus# :: Signed m -> Signed n -> Signed (1 + Max m n)"
, "template" : "~IF~AND[~SIZE[~TYP[0]],~SIZE[~TYP[1]]]~THENresize(~ARG[0],~SIZE[~TYPO]) + resize(~ARG[1],~SIZE[~TYPO])~ELSE~IF~SIZE[~TYP[0]]~THENresize(~ARG[0],~SIZE[~TYPO])~ELSEresize(~ARG[1],~SIZE[~TYPO])~FI~FI"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.minus#"
, "kind" : "Expression"
, "type" : "minus# :: Signed m -> Signed n -> Signed (1 + Max m n)"
, "template" : "~IF~AND[~SIZE[~TYP[0]],~SIZE[~TYP[1]]]~THENresize(~ARG[0],~SIZE[~TYPO]) - resize(~ARG[1],~SIZE[~TYPO])~ELSE~IF~SIZE[~TYP[0]]~THENresize(~ARG[0],~SIZE[~TYPO])~ELSEresize(- ~ARG[1],~SIZE[~TYPO])~FI~FI"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.times#"
, "kind" : "Expression"
, "type" : "times# :: Signed m -> Signed n -> Signed (m + n)"
, "template" : "~IF~AND[~SIZE[~TYP[0]],~SIZE[~TYP[1]]]~THEN~ARG[0] * ~ARG[1]~ELSEsigned'(~SIZE[~TYPO]-1 downto 0 => '0')~FI"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.rem#"
, "kind" : "Expression"
, "type" : "rem# :: Signed n -> Signed n -> Signed n"
, "template" : "~ARG[0] rem ~ARG[1]"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.div#"
, "kind" : "Declaration"
, "type" : "div# :: Signed n -> Signed n -> Signed n"
, "template" :
"-- divSigned begin
~GENSYM[divSigned][0] : block
signal ~GENSYM[resultPos][1] : boolean;
signal ~GENSYM[dividerNeg][2] : boolean;
signal ~GENSYM[dividend2][3] : signed(~SIZE[~TYPO] downto 0);
signal ~GENSYM[quot_res][4] : signed(~SIZE[~TYPO] downto 0);
begin
~SYM[1] <= ~VAR[dividend][0](~VAR[dividend][0]'high) = ~VAR[divider][1](~VAR[divider][1]'high);
~SYM[2] <= ~VAR[divider][1](~VAR[divider][1]'high) = '1';
~SYM[3] <= resize(~VAR[dividend][0],~SIZE[~TYPO]+1) when ~SYM[1] else
(resize(~VAR[dividend][0],~SIZE[~TYPO]+1) - resize(~VAR[divider][1],~SIZE[~TYPO]+1) - 1) when ~SYM[2] else
(resize(~VAR[dividend][0],~SIZE[~TYPO]+1) - resize(~VAR[divider][1],~SIZE[~TYPO]+1) + 1);
~SYM[4] <= ~SYM[3] / ~VAR[divider][1];
~RESULT <= signed(~SYM[4](~SIZE[~TYPO]-1 downto 0));
end block;
-- divSigned end"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.mod#"
, "kind" : "Expression"
, "type" : "mod# :: Signed n -> Signed n -> Signed n"
, "template" : "~ARG[0] mod ~ARG[1]"
}
}
, { "BlackBoxHaskell" :
{ "name" : "Clash.Sized.Internal.Signed.toInteger#"
, "workInfo" : "Never"
, "templateFunction" : "Clash.Primitives.Sized.ToInteger.signedToIntegerVHDL"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.and#"
, "kind" : "Expression"
, "type" : "and# :: KnownNat n => Signed n -> Signed n -> Signed n"
, "template" : "~ARG[1] and ~ARG[2]"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.or#"
, "kind" : "Expression"
, "type" : "or# :: KnownNat n => Signed n -> Signed n -> Signed n"
, "template" : "~ARG[1] or ~ARG[2]"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.xor#"
, "kind" : "Expression"
, "type" : "xor# :: KnownNat n => Signed n -> Signed n -> Signed n"
, "template" : "~ARG[1] xor ~ARG[2]"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.complement#"
, "kind" : "Expression"
, "type" : "complement# :: KnownNat n => Signed n -> Signed n"
, "template" : "not ~ARG[1]"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.shiftL#"
, "kind" : "Expression"
, "type" : "shiftL# :: KnownNat n => Signed n -> Int -> Signed n"
, "template" : "shift_left(~ARG[1],to_integer(~ARG[2]))"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.shiftR#"
, "kind" : "Expression"
, "type" : "shiftR# :: KnownNat n => Signed n -> Int -> Signed n"
, "template" : "shift_right(~ARG[1],to_integer(~ARG[2]))"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.rotateL#"
, "kind" : "Expression"
, "type" : "rotateL# :: KnownNat n => Signed n -> Int -> Signed n"
, "template" : "rotate_left(~ARG[1],to_integer(~ARG[2]))"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.rotateR#"
, "kind" : "Expression"
, "type" : "rotateR# :: KnownNat n => Signed n -> Int -> Signed n"
, "template" : "rotate_right(~ARG[1],to_integer(~ARG[2]))"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.resize#"
, "workInfo" : "Never"
, "kind" : "Expression"
, "type" : "resize# :: (KnownNat n, KnownNat m) => Signed n -> Signed m"
, "template" : "~IF~SIZE[~TYP[2]]~THENresize(~ARG[2],~LIT[1])~ELSEsigned'(~SIZE[~TYPO]-1 downto 0 => '0')~FI"
}
}
, { "BlackBox" :
{ "name" : "Clash.Sized.Internal.Signed.truncateB#"
, "workInfo" : "Never"
, "kind" : "Expression"
, "type" : "truncateB# :: KnownNat m => Signed (n + m) -> Signed m"
, "template" : "~IF~SIZE[~TYPO]~THEN~VAR[s][1](~LIT[0]-1 downto 0)~ELSEsigned'(0 downto 1 => '0')~FI"
}
}
]