packages feed

clash-lib-1.10.3: prims/vhdl/GHC_Prim.primitives.yaml

- BlackBox:
    name: ["GHC.Prim.gtChar#", "GHC.Internal.Prim.gtChar#"]
    kind: Declaration
    type: 'gtChar# :: Char#
      -> Char# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geChar#", "GHC.Internal.Prim.geChar#"]
    kind: Declaration
    type: 'geChar# :: Char#
      -> Char# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.eqChar#", "GHC.Internal.Prim.eqChar#"]
    kind: Declaration
    type: 'eqChar# :: Char#
      -> Char# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neChar#", "GHC.Internal.Prim.neChar#"]
    kind: Declaration
    type: 'neChar# :: Char#
      -> Char# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltChar#", "GHC.Internal.Prim.ltChar#"]
    kind: Declaration
    type: 'ltChar# :: Char#
      -> Char# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leChar#", "GHC.Internal.Prim.leChar#"]
    kind: Declaration
    type: 'leChar# :: Char#
      -> Char# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ord#", "GHC.Internal.Prim.ord#"]
    kind: Expression
    type: 'ord# :: Char# ->
      Int#'
    template: signed(std_logic_vector(resize(~ARG[0],~SIZE[~TYPO])))
- BlackBox:
    name: ["GHC.Prim.*#", "GHC.Internal.Prim.*#"]
    kind: Declaration
    type: '(*#) :: Int# ->
      Int# -> Int#'
    template: |-
      ~GENSYM[~RESULT_mult][0] : block
        signal ~GENSYM[~RESULT_mult_full][1] : signed(~SIZE[~TYPO]*2-1 downto 0);
      begin
        ~SYM[1] <= ~ARG[0] * ~ARG[1];
        ~RESULT <= ~SYM[1](~SIZE[~TYPO]-1 downto 0);
      end block;
- BlackBox:
    name: ["GHC.Prim.remInt#", "GHC.Internal.Prim.remInt#"]
    kind: Declaration
    type: 'remInt# :: Int#
      -> Int# -> Int#'
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemInt#", "GHC.Internal.Prim.quotRemInt#"]
    kind: Declaration
    type: 'quotRemInt# ::
      Int# -> Int# -> (#Int#, Int##)'
    template: |2-

      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.andI#", "GHC.Internal.Prim.andI#"]
    kind: Expression
    type: 'and# :: Int# ->
      Int# -> Int#'
    template: ~ARG[0] and ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.orI#", "GHC.Internal.Prim.orI#"]
    kind: Expression
    type: 'or# :: Int# ->
      Int# -> Int#'
    template: ~ARG[0] or ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.xorI#", "GHC.Internal.Prim.xorI#"]
    kind: Expression
    type: 'xor# :: Int# ->
      Int# -> Int#'
    template: ~ARG[0] xor ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.notI#", "GHC.Internal.Prim.notI#"]
    kind: Expression
    type: 'not# :: Int# ->
      Int#'
    template: not ~ARG[0]
- BlackBox:
    name: ["GHC.Prim.negateInt#", "GHC.Internal.Prim.negateInt#"]
    kind: Expression
    type: 'negateInt# :: Int#
      -> Int#'
    template: -~ARG[0]
- BlackBox:
    name: ["GHC.Prim.>#", "GHC.Internal.Prim.>#"]
    kind: Declaration
    type: '(>#) :: Int# ->
      Int# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.>=#", "GHC.Internal.Prim.>=#"]
    kind: Declaration
    type: '(>=#) :: Int# ->
      Int# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.==#", "GHC.Internal.Prim.==#"]
    kind: Declaration
    type: '(==) :: Int# ->
      Int# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim./=#", "GHC.Internal.Prim./=#"]
    kind: Declaration
    type: '(/=#) :: Int# ->
      Int# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.<#", "GHC.Internal.Prim.<#"]
    kind: Declaration
    type: '(<#) :: Int# ->
      Int# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.<=#", "GHC.Internal.Prim.<=#"]
    kind: Declaration
    type: '(<=#) :: Int# ->
      Int# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.chr#", "GHC.Internal.Prim.chr#"]
    kind: Expression
    type: 'ord# :: Int# ->
      Chr#'
    template: resize(unsigned(std_logic_vector(~ARG[0])),21)
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.int2Word#", "GHC.Internal.Prim.int2Word#"]
    kind: Expression
    type: 'word2Int# :: Int#
      -> Word#'
    template: unsigned(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.uncheckedIShiftL#", "GHC.Internal.Prim.uncheckedIShiftL#"]
    kind: Declaration
    type: 'uncheckedIShiftL#
      :: Int# -> Int# -> Int#'
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedIShiftRA#", "GHC.Internal.Prim.uncheckedIShiftRA#"]
    kind: Declaration
    type: 'uncheckedIShiftRA#
      :: Int# -> Int# -> Int#'
    template: |-
      ~GENSYM[~RESULT_shiftR][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_right(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedIShiftRL#", "GHC.Internal.Prim.uncheckedIShiftRL#"]
    kind: Declaration
    type: 'uncheckedIShiftRL#
      :: Int# -> Int# -> Int#'
    template: |-
      ~GENSYM[~RESULT_shiftRL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= ~ARG[0] srl ~SYM[1]
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.timesWord#", "GHC.Internal.Prim.timesWord#"]
    kind: Expression
    type: 'timesWord# :: Word#
      -> Word# -> Word#'
    template: resize(~ARG[0] * ~ARG[1],~SIZE[~TYPO])
- BlackBox:
    name: ["GHC.Prim.remWord#", "GHC.Internal.Prim.remWord#"]
    kind: Declaration
    type: 'remWord# :: Word#
      -> Word# -> Word#'
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemWord#", "GHC.Internal.Prim.quotRemWord#"]
    kind: Declaration
    type: 'quotRemWord# ::
      Word# -> Word# -> (#Word#, Word##)'
    template: |2-

      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.and#", "GHC.Internal.Prim.and#"]
    kind: Expression
    type: 'and# :: Word# ->
      Word# -> Word#'
    template: ~ARG[0] and ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.or#", "GHC.Internal.Prim.or#"]
    kind: Expression
    type: 'or# :: Word# ->
      Word# -> Word#'
    template: ~ARG[0] or ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.xor#", "GHC.Internal.Prim.xor#"]
    kind: Expression
    type: 'xor# :: Word# ->
      Word# -> Word#'
    template: ~ARG[0] xor ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.not#", "GHC.Internal.Prim.not#"]
    kind: Expression
    type: 'not# :: Word# ->
      Word#'
    template: not ~ARG[0]
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftL#", "GHC.Internal.Prim.uncheckedShiftL#"]
    kind: Declaration
    type: 'uncheckedShiftL#
      :: Word# -> Int# -> Word#'
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRL#", "GHC.Internal.Prim.uncheckedShiftRL#"]
    kind: Declaration
    type: 'uncheckedShiftR#
      :: Word# -> Int# -> Word#'
    template: |-
      ~GENSYM[~RESULT_shiftR][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_right(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.word2Int#", "GHC.Internal.Prim.word2Int#"]
    kind: Expression
    type: 'word2Int# :: word#
      -> Int#'
    template: signed(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.gtWord#", "GHC.Internal.Prim.gtWord#"]
    kind: Declaration
    type: 'gtWord# :: Word#
      -> Word# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geWord#", "GHC.Internal.Prim.geWord#"]
    kind: Declaration
    type: 'geWord# :: Word#
      -> Word# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.eqWord#", "GHC.Internal.Prim.eqWord#"]
    kind: Declaration
    type: 'eqWord# :: Word#
      -> Word# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neWord#", "GHC.Internal.Prim.neWord#"]
    kind: Declaration
    type: 'neWord# :: Word#
      -> Word# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltWord#", "GHC.Internal.Prim.ltWord#"]
    kind: Declaration
    type: 'ltWord# :: Word#
      -> Word# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leWord#", "GHC.Internal.Prim.leWord#"]
    kind: Declaration
    type: 'leWord# :: Word#
      -> Word# -> Int#'
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.popCnt8#", "GHC.Internal.Prim.popCnt8#"]
    kind: Declaration
    type: 'popCnt8 :: Word#
      -> Word#'
    template: |-
      -- popCnt8 begin
      ~GENSYM[popCnt8][0] : block
        -- given a level and a depth, calculate the corresponding index into the
        -- intermediate array
        function ~GENSYM[depth2Index][1] (~SYM[levelsIn],~SYM[depthIn] : in natural) return natural is
        begin
          return (2 ** ~SYM[levelsIn] - 2 ** ~SYM[depthIn]);
        end function;

        constant ~GENSYM[width][2] : natural := 8;
        constant ~GENSYM[levels][3] : natural := natural (ceil (log2 (real (~SYM[2]))));
        type ~GENSYM[popCnt_res_vec][4] is array (natural range <>) of unsigned(~SYM[3] downto 0);
        signal ~GENSYM[intermediate][5] : ~SYM[4](0 to (2*~SYM[2])-2);
      begin
        -- put input into the first half of the intermediate array
        ~GENSYM[make_array][6]: for ~GENSYM[i][7] in 0 to (~SYM[2] - 1) generate
          ~SYM[5](~SYM[7]) <= resize(~VAR[input][0](~SYM[7] downto ~SYM[7]),~SYM[3]+1);
        end generate;

        -- Create the tree of adders
        ~GENSYM[make_tree][8] : if ~SYM[3] /= 0 generate
          ~GENSYM[tree_depth][9] : for ~GENSYM[d][10] in ~SYM[3]-1 downto 0 generate
            ~GENSYM[tree_depth_loop][11] : for ~GENSYM[i][12] in 0 to (natural(2**~SYM[10]) - 1) generate
              ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+1)+~SYM[12]) <=
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])) +
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])+1);
            end generate;
          end generate;
        end generate;

        -- The last element of the intermediate array holds the result
        ~RESULT <= resize(~SYM[5]((2*~SYM[2])-2),~SIZE[~TYPO]);
      end block;
      -- popCnt8 end
- BlackBox:
    name: ["GHC.Prim.popCnt16#", "GHC.Internal.Prim.popCnt16#"]
    kind: Declaration
    type: 'popCnt16 :: Word#
      -> Word#'
    template: |-
      -- popCnt16 begin
      ~GENSYM[popCnt16][0] : block
        -- given a level and a depth, calculate the corresponding index into the
        -- intermediate array
        function ~GENSYM[depth2Index][1] (~SYM[levelsIn],~SYM[depthIn] : in natural) return natural is
        begin
          return (2 ** ~SYM[levelsIn] - 2 ** ~SYM[depthIn]);
        end function;

        constant ~GENSYM[width][2] : natural := 16;
        constant ~GENSYM[levels][3] : natural := natural (ceil (log2 (real (~SYM[2]))));
        type ~GENSYM[popCnt_res_vec][4] is array (natural range <>) of unsigned(~SYM[3] downto 0);
        signal ~GENSYM[intermediate][5] : ~SYM[4](0 to (2*~SYM[2])-2);
      begin
        -- put input into the first half of the intermediate array
        ~GENSYM[make_array][6]: for ~GENSYM[i][7] in 0 to (~SYM[2] - 1) generate
          ~SYM[5](~SYM[7]) <= resize(~VAR[input][0](~SYM[7] downto ~SYM[7]),~SYM[3]+1);
        end generate;

        -- Create the tree of adders
        ~GENSYM[make_tree][8] : if ~SYM[3] /= 0 generate
          ~GENSYM[tree_depth][9] : for ~GENSYM[d][10] in ~SYM[3]-1 downto 0 generate
            ~GENSYM[tree_depth_loop][11] : for ~GENSYM[i][12] in 0 to (natural(2**~SYM[10]) - 1) generate
              ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+1)+~SYM[12]) <=
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])) +
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])+1);
            end generate;
          end generate;
        end generate;

        -- The last element of the intermediate array holds the result
        ~RESULT <= resize(~SYM[5]((2*~SYM[2])-2),~SIZE[~TYPO]);
      end block;
      -- popCnt16 end
- BlackBox:
    name: ["GHC.Prim.popCnt32#", "GHC.Internal.Prim.popCnt32#"]
    kind: Declaration
    type: 'popCnt32 :: Word#
      -> Word#'
    template: |-
      -- popCnt32 begin
      ~GENSYM[popCnt32][0] : block
        -- given a level and a depth, calculate the corresponding index into the
        -- intermediate array
        function ~GENSYM[depth2Index][1] (~SYM[levelsIn],~SYM[depthIn] : in natural) return natural is
        begin
          return (2 ** ~SYM[levelsIn] - 2 ** ~SYM[depthIn]);
        end function;

        constant ~GENSYM[width][2] : natural := 32;
        constant ~GENSYM[levels][3] : natural := natural (ceil (log2 (real (~SYM[2]))));
        type ~GENSYM[popCnt_res_vec][4] is array (natural range <>) of unsigned(~SYM[3] downto 0);
        signal ~GENSYM[intermediate][5] : ~SYM[4](0 to (2*~SYM[2])-2);
      begin
        -- put input into the first half of the intermediate array
        ~GENSYM[make_array][6]: for ~GENSYM[i][7] in 0 to (~SYM[2] - 1) generate
          ~SYM[5](~SYM[7]) <= resize(~VAR[input][0](~SYM[7] downto ~SYM[7]),~SYM[3]+1);
        end generate;

        -- Create the tree of adders
        ~GENSYM[make_tree][8] : if ~SYM[3] /= 0 generate
          ~GENSYM[tree_depth][9] : for ~GENSYM[d][10] in ~SYM[3]-1 downto 0 generate
            ~GENSYM[tree_depth_loop][11] : for ~GENSYM[i][12] in 0 to (natural(2**~SYM[10]) - 1) generate
              ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+1)+~SYM[12]) <=
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])) +
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])+1);
            end generate;
          end generate;
        end generate;

        -- The last element of the intermediate array holds the result
        ~RESULT <= resize(~SYM[5]((2*~SYM[2])-2),~SIZE[~TYPO]);
      end block;
      -- popCnt32 end
- BlackBox:
    name: ["GHC.Prim.popCnt64#", "GHC.Internal.Prim.popCnt64#"]
    kind: Declaration
    type: 'popCnt64 :: Word#
      -> Word#'
    template: |-
      -- popCnt64 begin
      ~GENSYM[popCnt64][0] : block
        -- given a level and a depth, calculate the corresponding index into the
        -- intermediate array
        function ~GENSYM[depth2Index][1] (~SYM[levelsIn],~SYM[depthIn] : in natural) return natural is
        begin
          return (2 ** ~SYM[levelsIn] - 2 ** ~SYM[depthIn]);
        end function;

        constant ~GENSYM[width][2] : natural := 64;
        constant ~GENSYM[levels][3] : natural := natural (ceil (log2 (real (~SYM[2]))));
        type ~GENSYM[popCnt_res_vec][4] is array (natural range <>) of unsigned(~SYM[3] downto 0);
        signal ~GENSYM[intermediate][5] : ~SYM[4](0 to (2*~SYM[2])-2);
      begin
        -- put input into the first half of the intermediate array
        ~GENSYM[make_array][6]: for ~GENSYM[i][7] in 0 to (~SYM[2] - 1) generate
          ~SYM[5](~SYM[7]) <= resize(~VAR[input][0](~SYM[7] downto ~SYM[7]),~SYM[3]+1);
        end generate;

        -- Create the tree of adders
        ~GENSYM[make_tree][8] : if ~SYM[3] /= 0 generate
          ~GENSYM[tree_depth][9] : for ~GENSYM[d][10] in ~SYM[3]-1 downto 0 generate
            ~GENSYM[tree_depth_loop][11] : for ~GENSYM[i][12] in 0 to (natural(2**~SYM[10]) - 1) generate
              ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+1)+~SYM[12]) <=
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])) +
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])+1);
            end generate;
          end generate;
        end generate;

        -- The last element of the intermediate array holds the result
        ~RESULT <= resize(~SYM[5]((2*~SYM[2])-2),~SIZE[~TYPO]);
      end block;
      -- popCnt64 end
- BlackBox:
    name: ["GHC.Prim.popCnt#", "GHC.Internal.Prim.popCnt#"]
    kind: Declaration
    type: 'popCnt :: Word#
      -> Word#'
    template: |-
      -- popCnt begin
      ~GENSYM[popCnt][0] : block
        -- given a level and a depth, calculate the corresponding index into the
        -- intermediate array
        function ~GENSYM[depth2Index][1] (~SYM[levelsIn],~SYM[depthIn] : in natural) return natural is
        begin
          return (2 ** ~SYM[levelsIn] - 2 ** ~SYM[depthIn]);
        end function;

        constant ~GENSYM[width][2] : natural := ~SIZE[~TYPO];
        constant ~GENSYM[levels][3] : natural := natural (ceil (log2 (real (~SYM[2]))));
        type ~GENSYM[popCnt_res_vec][4] is array (natural range <>) of unsigned(~SYM[3] downto 0);
        signal ~GENSYM[intermediate][5] : ~SYM[4](0 to (2*~SYM[2])-2);
      begin
        -- put input into the first half of the intermediate array
        ~GENSYM[make_array][6]: for ~GENSYM[i][7] in 0 to (~SYM[2] - 1) generate
          ~SYM[5](~SYM[7]) <= resize(~VAR[input][0](~SYM[7] downto ~SYM[7]),~SYM[3]+1);
        end generate;

        -- Create the tree of adders
        ~GENSYM[make_tree][8] : if ~SYM[3] /= 0 generate
          ~GENSYM[tree_depth][9] : for ~GENSYM[d][10] in ~SYM[3]-1 downto 0 generate
            ~GENSYM[tree_depth_loop][11] : for ~GENSYM[i][12] in 0 to (natural(2**~SYM[10]) - 1) generate
              ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+1)+~SYM[12]) <=
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])) +
                ~SYM[5](~SYM[1](~SYM[3]+1,~SYM[10]+2)+(2*~SYM[12])+1);
            end generate;
          end generate;
        end generate;

        -- The last element of the intermediate array holds the result
        ~RESULT <= resize(~SYM[5]((2*~SYM[2])-2),~SIZE[~TYPO]);
      end block;
      -- popCnt end
- BlackBox:
    name: ["GHC.Prim.clz8#", "GHC.Internal.Prim.clz8#"]
    kind: Expression
    type: 'clz8 :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz8
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz8#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
          function clz8 (constant v : unsigned(0 to 7)) return unsigned;
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;

          function clz8 (constant v : unsigned(0 to 7)) return unsigned is
            variable e : unsigned(0 to 7);     -- 8
            variable a : unsigned(0 to 2*3-1); -- 6
          begin
            for i in 0 to 3 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));    end loop;
            for i in 0 to 1 loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3)); end loop;
            return clzi(3,a(0 to 5));
          end function;
        end;
    template: resize(~INCLUDENAME[0].clz8(~VAR[][0](7 downto 0)),~SIZE[~TYPO])
- BlackBox:
    name: ["GHC.Prim.clz16#", "GHC.Internal.Prim.clz16#"]
    kind: Expression
    type: 'clz16 :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz16
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz16#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
          function clz16 (constant v : unsigned(0 to 15)) return unsigned;
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;

          function clz16 (constant v : unsigned(0 to 15)) return unsigned is
            variable e : unsigned(0 to 15);    -- 16
            variable a : unsigned(0 to 4*3-1); -- 12
            variable b : unsigned(0 to 2*4-1); -- 8
          begin
            for i in 0 to 7 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));    end loop;
            for i in 0 to 3 loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3)); end loop;
            for i in 0 to 1 loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5)); end loop;
            return clzi(4,b(0 to 7));
          end function;
        end;
    template: resize(~INCLUDENAME[0].clz16(~VAR[][0](15 downto 0)),~SIZE[~TYPO])
- BlackBox:
    name: ["GHC.Prim.clz32#", "GHC.Internal.Prim.clz32#"]
    kind: Expression
    type: 'clz32 :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz32
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz32#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
          function clz32 (constant v : unsigned(0 to 31)) return unsigned;
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;

          function clz32 (constant v : unsigned(0 to 31)) return unsigned is
            variable e : unsigned(0 to 31);    -- 32
            variable a : unsigned(0 to 8*3-1); -- 24
            variable b : unsigned(0 to 4*4-1); -- 16
            variable c : unsigned(0 to 2*5-1); -- 10
          begin
            for i in 0 to 15 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));    end loop;
            for i in 0 to 7  loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3)); end loop;
            for i in 0 to 3  loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5)); end loop;
            for i in 0 to 1  loop c(i*5 to i*5+4):=clzi(4,b(i*8 to i*8+7)); end loop;
            return clzi(5,c(0 to 9));
          end function;
        end;
    template: resize(~INCLUDENAME[0].clz32(~VAR[][0](31 downto 0)),~SIZE[~TYPO])

- BlackBox:
    name: ["GHC.Prim.clz64#", "GHC.Internal.Prim.clz64#"]
    kind: Expression
    type: 'clz64 :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz64
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz64#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
          function clz64 (constant v : unsigned(0 to 63)) return unsigned;
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;

          function clz64 (constant v : unsigned(0 to 63)) return unsigned is
            variable e : unsigned(0 to 63);     -- 64
            variable a : unsigned(0 to 16*3-1); -- 48
            variable b : unsigned(0 to 8*4-1);  -- 32
            variable c : unsigned(0 to 4*5-1);  -- 20
            variable d : unsigned(0 to 2*6-1);  -- 12
          begin
            for i in 0 to 31 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));      end loop;
            for i in 0 to 15 loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3));   end loop;
            for i in 0 to 7  loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5));   end loop;
            for i in 0 to 3  loop c(i*5 to i*5+4):=clzi(4,b(i*8 to i*8+7));   end loop;
            for i in 0 to 1  loop d(i*6 to i*6+5):=clzi(5,c(i*10 to i*10+9)); end loop;
            return clzi(6,d(0 to 11));
          end function;
        end;
    template: resize(~INCLUDENAME[0].clz64(~ARG[0]),~SIZE[~TYPO])
- BlackBox:
    name: ["GHC.Prim.clz#", "GHC.Internal.Prim.clz#"]
    kind: Expression
    type: 'clz :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
        ~IF ~IW64 ~THEN
          function clz (constant v : unsigned(0 to 63)) return unsigned;
        ~ELSE
          function clz (constant v : unsigned(0 to 31)) return unsigned;
        ~FI
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;
        ~IF ~IW64 ~THEN
          function clz (constant v : unsigned(0 to 63)) return unsigned is
            variable e : unsigned(0 to 63);     -- 64
            variable a : unsigned(0 to 16*3-1); -- 48
            variable b : unsigned(0 to 8*4-1);  -- 32
            variable c : unsigned(0 to 4*5-1);  -- 20
            variable d : unsigned(0 to 2*6-1);  -- 12
          begin
            for i in 0 to 31 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));      end loop;
            for i in 0 to 15 loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3));   end loop;
            for i in 0 to 7  loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5));   end loop;
            for i in 0 to 3  loop c(i*5 to i*5+4):=clzi(4,b(i*8 to i*8+7));   end loop;
            for i in 0 to 1  loop d(i*6 to i*6+5):=clzi(5,c(i*10 to i*10+9)); end loop;
            return clzi(6,d(0 to 11));
          end function;
        ~ELSE
          function clz (constant v : unsigned(0 to 31)) return unsigned is
            variable e : unsigned(0 to 31);    -- 32
            variable a : unsigned(0 to 8*3-1); -- 24
            variable b : unsigned(0 to 4*4-1); -- 16
            variable c : unsigned(0 to 2*5-1); -- 10
          begin
            for i in 0 to 15 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));    end loop;
            for i in 0 to 7  loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3)); end loop;
            for i in 0 to 3  loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5)); end loop;
            for i in 0 to 1  loop c(i*5 to i*5+4):=clzi(4,b(i*8 to i*8+7)); end loop;
            return clzi(5,c(0 to 9));
          end function;
        ~FI
        end;
    template: resize(~INCLUDENAME[0].clz(~ARG[0]),~SIZE[~TYPO])
- BlackBox:
    name: ["GHC.Prim.ctz8#", "GHC.Internal.Prim.ctz8#"]
    kind: Declaration
    type: 'ctz8 :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz8
      comment: This is a copy of clz8, it's used to implement ctz8
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz8#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
          function clz8 (constant v : unsigned(0 to 7)) return unsigned;
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;

          function clz8 (constant v : unsigned(0 to 7)) return unsigned is
            variable e : unsigned(0 to 7);     -- 8
            variable a : unsigned(0 to 2*3-1); -- 6
          begin
            for i in 0 to 3 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));    end loop;
            for i in 0 to 1 loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3)); end loop;
            return clzi(3,a(0 to 5));
          end function;
        end;
    template: |-
      -- ctz8 begin
      ~GENSYM[ctz8][0] : block
        signal ~GENSYM[w_reversed][5] : ~TYP[0];
      begin
        ~GENSYM[reverse_loop][6] : for ~GENSYM[n][7] in ~VAR[w][0]'range generate
          ~SYM[5](~VAR[w][0]'high - ~SYM[7]) <= ~VAR[w][0](~SYM[7]);
        end generate;
      ~IF ~IW64 ~THEN
        ~RESULT <= resize(~INCLUDENAME[0].clz8(~SYM[5](63 downto 56)),~SIZE[~TYPO]);
      ~ELSE
        ~RESULT <= resize(~INCLUDENAME[0].clz8(~SYM[5](31 downto 24)),~SIZE[~TYPO]);
      ~FI
      end block;
      -- ctz8 end
- BlackBox:
    name: ["GHC.Prim.ctz16#", "GHC.Internal.Prim.ctz16#"]
    kind: Declaration
    type: 'ctz16 :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz16
      comment: This is a copy of clz16, it's used to implement ctz16
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz16#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
          function clz16 (constant v : unsigned(0 to 15)) return unsigned;
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;

          function clz16 (constant v : unsigned(0 to 15)) return unsigned is
            variable e : unsigned(0 to 15);    -- 16
            variable a : unsigned(0 to 4*3-1); -- 12
            variable b : unsigned(0 to 2*4-1); -- 8
          begin
            for i in 0 to 7 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));    end loop;
            for i in 0 to 3 loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3)); end loop;
            for i in 0 to 1 loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5)); end loop;
            return clzi(4,b(0 to 7));
          end function;
        end;
    template: |-
      -- ctz16 begin
      ~GENSYM[ctz16][0] : block
        signal ~GENSYM[w_reversed][5] : ~TYP[0];
      begin
        ~GENSYM[reverse_loop][6] : for ~GENSYM[n][7] in ~VAR[w][0]'range generate
          ~SYM[5](~VAR[w][0]'high - ~SYM[7]) <= ~VAR[w][0](~SYM[7]);
        end generate;
      ~IF ~IW64 ~THEN
        ~RESULT <= resize(~INCLUDENAME[0].clz16(~SYM[5](63 downto 48)),~SIZE[~TYPO]);
      ~ELSE
        ~RESULT <= resize(~INCLUDENAME[0].clz16(~SYM[5](31 downto 16)),~SIZE[~TYPO]);
      ~FI
      end block;
      -- ctz16 end
- BlackBox:
    name: ["GHC.Prim.ctz32#", "GHC.Internal.Prim.ctz32#"]
    kind: Declaration
    type: 'ctz32 :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz32
      comment: This is a copy of clz32, it's used to implement ctz32
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz32#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
          function clz32 (constant v : unsigned(0 to 31)) return unsigned;
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;

          function clz32 (constant v : unsigned(0 to 31)) return unsigned is
            variable e : unsigned(0 to 31);    -- 32
            variable a : unsigned(0 to 8*3-1); -- 24
            variable b : unsigned(0 to 4*4-1); -- 16
            variable c : unsigned(0 to 2*5-1); -- 10
          begin
            for i in 0 to 15 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));    end loop;
            for i in 0 to 7  loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3)); end loop;
            for i in 0 to 3  loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5)); end loop;
            for i in 0 to 1  loop c(i*5 to i*5+4):=clzi(4,b(i*8 to i*8+7)); end loop;
            return clzi(5,c(0 to 9));
          end function;
        end;
    template: |-
      -- ctz32 begin
      ~GENSYM[ctz32][0] : block
        signal ~GENSYM[w_reversed][5] : ~TYP[0];
      begin
        ~GENSYM[reverse_loop][6] : for ~GENSYM[n][7] in ~VAR[w][0]'range generate
          ~SYM[5](~VAR[w][0]'high - ~SYM[7]) <= ~VAR[w][0](~SYM[7]);
        end generate;
      ~IF ~IW64 ~THEN
        ~RESULT <= resize(~INCLUDENAME[0].clz32(~SYM[5](63 downto 32)),~SIZE[~TYPO]);
      ~ELSE
        ~RESULT <= resize(~INCLUDENAME[0].clz32(~SYM[5]),~SIZE[~TYPO]);
      ~FI
      end block;
      -- ctz32 end
- BlackBox:
    name: ["GHC.Prim.ctz64#", "GHC.Internal.Prim.ctz64#"]
    kind: Declaration
    type: 'ctz64 :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz64
      comment: This is a copy of clz64, it's used to implement ctz64
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz64#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
          function clz64 (constant v : unsigned(0 to 63)) return unsigned;
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;

          function clz64 (constant v : unsigned(0 to 63)) return unsigned is
            variable e : unsigned(0 to 63);     -- 64
            variable a : unsigned(0 to 16*3-1); -- 48
            variable b : unsigned(0 to 8*4-1);  -- 32
            variable c : unsigned(0 to 4*5-1);  -- 20
            variable d : unsigned(0 to 2*6-1);  -- 12
          begin
            for i in 0 to 31 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));      end loop;
            for i in 0 to 15 loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3));   end loop;
            for i in 0 to 7  loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5));   end loop;
            for i in 0 to 3  loop c(i*5 to i*5+4):=clzi(4,b(i*8 to i*8+7));   end loop;
            for i in 0 to 1  loop d(i*6 to i*6+5):=clzi(5,c(i*10 to i*10+9)); end loop;
            return clzi(6,d(0 to 11));
          end function;
        end;
    template: |-
      -- ctz64 begin
      ~GENSYM[ctz64][0] : block
        signal ~GENSYM[w_reversed][5] : ~TYP[0];
      begin
        ~GENSYM[reverse_loop][6] : for ~GENSYM[n][7] in ~VAR[w][0]'range generate
          ~SYM[5](~VAR[w][0]'high - ~SYM[7]) <= ~VAR[w][0](~SYM[7]);
        end generate;

        ~RESULT <= resize(~INCLUDENAME[0].clz64(~SYM[5]),~SIZE[~TYPO]);
      end block;
      -- ctz64 end
- BlackBox:
    name: ["GHC.Prim.ctz#", "GHC.Internal.Prim.ctz#"]
    kind: Declaration
    type: 'ctz :: Word# -> Word#'
    imports:
    - ~INCLUDENAME[0].all
    includes:
    - name: clz
      comment: This is a copy of clz, it's used to implement ctz
      extension: vhdl
      template: |-
        -- helper function of GHC.Prim.clz#
        library IEEE;
        use IEEE.STD_LOGIC_1164.ALL;
        use IEEE.NUMERIC_STD.ALL;
        package ~INCLUDENAME[0] is
        ~IF ~IW64 ~THEN
          function clz (constant v : unsigned(0 to 63)) return unsigned;
        ~ELSE
          function clz (constant v : unsigned(0 to 31)) return unsigned;
        ~FI
        end;

        package body ~INCLUDENAME[0] is
          function enc (constant a : unsigned(1 downto 0)) return unsigned is
          begin
            case a is
              when "00" => return "10";
              when "01" => return "01";
              when "10" => return "00";
              when others => return "00";
            end case;
          end function;

          function clzi (
            constant n : in natural;
            constant i : in unsigned) return unsigned is
            variable v : unsigned(i'length-1 downto 0):=i;
          begin
            if v(n-1+n)='0' then
              return (v(n-1+n) and v(n-1)) & '0' & v(2*n-2 downto n);
            else
              return (v(n-1+n) and v(n-1)) & not v(n-1) & v(n-2 downto 0);
            end if;
          end function;
        ~IF ~IW64 ~THEN
          function clz (constant v : unsigned(0 to 63)) return unsigned is
            variable e : unsigned(0 to 63);     -- 64
            variable a : unsigned(0 to 16*3-1); -- 48
            variable b : unsigned(0 to 8*4-1);  -- 32
            variable c : unsigned(0 to 4*5-1);  -- 20
            variable d : unsigned(0 to 2*6-1);  -- 12
          begin
            for i in 0 to 31 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));      end loop;
            for i in 0 to 15 loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3));   end loop;
            for i in 0 to 7  loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5));   end loop;
            for i in 0 to 3  loop c(i*5 to i*5+4):=clzi(4,b(i*8 to i*8+7));   end loop;
            for i in 0 to 1  loop d(i*6 to i*6+5):=clzi(5,c(i*10 to i*10+9)); end loop;
            return clzi(6,d(0 to 11));
          end function;
        ~ELSE
          function clz (constant v : unsigned(0 to 31)) return unsigned is
            variable e : unsigned(0 to 31);    -- 32
            variable a : unsigned(0 to 8*3-1); -- 24
            variable b : unsigned(0 to 4*4-1); -- 16
            variable c : unsigned(0 to 2*5-1); -- 10
          begin
            for i in 0 to 15 loop e(i*2 to i*2+1):=enc(v(i*2 to i*2+1));    end loop;
            for i in 0 to 7  loop a(i*3 to i*3+2):=clzi(2,e(i*4 to i*4+3)); end loop;
            for i in 0 to 3  loop b(i*4 to i*4+3):=clzi(3,a(i*6 to i*6+5)); end loop;
            for i in 0 to 1  loop c(i*5 to i*5+4):=clzi(4,b(i*8 to i*8+7)); end loop;
            return clzi(5,c(0 to 9));
          end function;
        ~FI
        end;
    template: |-
      -- ctz begin
      ~GENSYM[ctz][0] : block
        signal ~GENSYM[w_reversed][6] : ~TYP[0];
      begin
        ~GENSYM[reverse_loop][7] : for ~GENSYM[n][8] in ~VAR[w][0]'range generate
          ~SYM[6](~VAR[w][0]'high - ~SYM[8]) <= ~VAR[w][0](~SYM[8]);
        end generate;
        ~RESULT <= resize(~INCLUDENAME[0].clz(~SYM[6]),~SIZE[~TYPO]);
      end block;
      -- ctz end
- BlackBox:
    name: ["GHC.Prim.byteSwap16#", "GHC.Internal.Prim.byteSwap16#"]
    kind: Declaration
    type: 'byteSwap16# ::
      Word# -> Word#'
    template: |-
      -- byteSwap16 begin~IF ~IW64 ~THEN
      ~RESULT <= ~VAR[w][0](63 downto 16) & ~VAR[w][0](7 downto 0) & ~VAR[w][0](15 downto 8);~ELSE
      ~RESULT <= ~VAR[w][0](31 downto 16) & ~VAR[w][0](7 downto 0) & ~VAR[w][0](15 downto 8);~FI
      -- byteSwap16 end
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.byteSwap32#", "GHC.Internal.Prim.byteSwap32#"]
    kind: Declaration
    type: 'byteSwap32# ::
      Word# -> Word#'
    template: |-
      -- byteSwap32 begin~IF ~IW64 ~THEN
      ~RESULT <= ~VAR[w][0](63 downto 32) & ~VAR[w][0](7  downto 0 ) & ~VAR[w][0](15 downto 8)
                                          & ~VAR[w][0](23 downto 16) & ~VAR[w][0](31 downto 24);~ELSE
      ~RESULT <= ~VAR[w][0](7  downto 0 ) & ~VAR[w][0](15 downto 8)
               & ~VAR[w][0](23 downto 16) & ~VAR[w][0](31 downto 24);~FI
      -- byteSwap32 end
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.byteSwap64#", "GHC.Internal.Prim.byteSwap64#"]
    kind: Declaration
    type: 'byteSwap64# ::
      Word# -> Word#'
    template: |-
      -- byteSwap64 begin
      ~RESULT <= ~VAR[w][0](7  downto 0 ) & ~VAR[w][0](15 downto 8)
               & ~VAR[w][0](23 downto 16) & ~VAR[w][0](31 downto 24)
               & ~VAR[w][0](39 downto 32) & ~VAR[w][0](47 downto 40)
               & ~VAR[w][0](55 downto 48) & ~VAR[w][0](63 downto 56);
      -- byteSwap64 end
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.byteSwap#", "GHC.Internal.Prim.byteSwap#"]
    kind: Declaration
    type: 'byteSwap# :: Word#
      -> Word#'
    template: |-
      -- byteSwap begin ~IF ~IW64 ~THEN
      ~RESULT <= ~VAR[w][0](7  downto 0 ) & ~VAR[w][0](15 downto 8)
               & ~VAR[w][0](23 downto 16) & ~VAR[w][0](31 downto 24)
               & ~VAR[w][0](39 downto 32) & ~VAR[w][0](47 downto 40)
               & ~VAR[w][0](55 downto 48) & ~VAR[w][0](63 downto 56);~ELSE
      ~RESULT <= ~VAR[w][0](7  downto 0 ) & ~VAR[w][0](15 downto 8)
               & ~VAR[w][0](23 downto 16) & ~VAR[w][0](31 downto 24);~FI
      -- byteSwap end
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.narrow8Int#", "GHC.Internal.Prim.narrow8Int#"]
    kind: Expression
    type: 'narrow8Int# ::
      Int# -> Int#'
    template: resize(~VAR[i][0](7 downto 0),~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.narrow16Int#", "GHC.Internal.Prim.narrow16Int#"]
    kind: Expression
    type: 'narrow16Int# ::
      Int# -> Int#'
    template: resize(~VAR[i][0](15 downto 0),~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.narrow32Int#", "GHC.Internal.Prim.narrow32Int#"]
    kind: Expression
    type: 'narrow32Int# ::
      Int# -> Int#'
    template: resize(~VAR[i][0](31 downto 0),~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.narrow8Word#", "GHC.Internal.Prim.narrow8Word#"]
    kind: Expression
    type: 'narrow8Word# ::
      Word# -> Word#'
    template: resize(~VAR[w][0](7 downto 0),~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.narrow16Word#", "GHC.Internal.Prim.narrow16Word#"]
    kind: Expression
    type: 'narrow16Word# ::
      Word# -> Word#'
    template: resize(~VAR[w][0](15 downto 0),~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.narrow32Word#", "GHC.Internal.Prim.narrow32Word#"]
    kind: Expression
    type: 'narrow32Word# ::
      Word# -> Word#'
    template: resize(~VAR[w][0](31 downto 0),~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.bitReverse#", "GHC.Internal.Prim.bitReverse#"]
    kind: Declaration
    type: 'bitReverse# ::
      Word# -> Word#'
    template: |-
      -- bitReverse begin
      ~GENSYM[bitReverse][0] : for ~GENSYM[i][1] in 0 to ~IF ~IW64 ~THEN 63 ~ELSE 31 ~FI generate
      begin
      ~RESULT(~SYM[1]) <= ~VAR[x][0](~IF ~IW64 ~THEN 63 ~ELSE 31 ~FI-~SYM[1]);
      end generate;
      -- bitReverse end
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.bitReverse8#", "GHC.Internal.Prim.bitReverse8#"]
    kind: Declaration
    type: 'bitReverse8# ::
      Word# -> Word#'
    template: |-
      -- bitReverse8 begin
      ~GENSYM[bitReverse8][0] : for ~GENSYM[i][1] in 0 to 7 generate
      begin
      ~RESULT(~SYM[1]) <= ~VAR[x][0](7-~SYM[1]);
      end generate;
      -- bitReverse8 end
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.bitReverse16#", "GHC.Internal.Prim.bitReverse16#"]
    kind: Declaration
    type: 'bitReverse16# ::
      Word# -> Word#'
    template: |-
      -- bitReverse16 begin
      ~GENSYM[bitReverse16][0] : for ~GENSYM[i][1] in 0 to 15 generate
      begin
      ~RESULT(~SYM[1]) <= ~VAR[x][0](15-~SYM[1]);
      end generate;
      -- bitReverse16 end
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.bitReverse32#", "GHC.Internal.Prim.bitReverse32#"]
    kind: Declaration
    type: 'bitReverse32# ::
      Word# -> Word#'
    template: |-
      -- bitReverse32 begin
      ~GENSYM[bitReverse32][0] : for ~GENSYM[i][1] in 0 to 31 generate
      begin
      ~RESULT(~SYM[1]) <= ~VAR[x][0](31-~SYM[1]);
      end generate;
      -- bitReverse32 end
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.bitReverse64#", "GHC.Internal.Prim.bitReverse64#"]
    kind: Declaration
    type: 'bitReverse64# ::
      Word# -> Word#'
    template: |-
      -- bitReverse64 begin
      ~GENSYM[bitReverse64][0] : for ~GENSYM[i][1] in 0 to 63 generate
      begin
      ~RESULT(~SYM[1]) <= ~VAR[x][0](63-~SYM[1]);
      end generate;
      -- bitReverse64 end
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.quotInt#", "GHC.Internal.Prim.quotInt#"]
    kind: Declaration
    type: 'quotInt# :: Int#
      -> Int# -> Int#'
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotWord#", "GHC.Internal.Prim.quotWord#"]
    kind: Declaration
    type: 'quotWord# :: Word#
      -> Word# -> Word#'
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.int8ToInt#", "GHC.Internal.Prim.int8ToInt#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.intToInt8#", "GHC.Internal.Prim.intToInt8#"]
    kind: Expression
    template: ~VAR[i][0](7 downto 0)
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.negateInt8#", "GHC.Internal.Prim.negateInt8#"]
    kind: Expression
    template: -~ARG[0]
- BlackBox:
    name: ["GHC.Prim.timesInt8#", "GHC.Internal.Prim.timesInt8#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_mult][0] : block
        signal ~GENSYM[~RESULT_mult_full][1] : signed(~SIZE[~TYPO]*2-1 downto 0);
      begin
        ~SYM[1] <= ~ARG[0] * ~ARG[1];
        ~RESULT <= ~SYM[1](~SIZE[~TYPO]-1 downto 0);
      end block;
- BlackBox:
    name: ["GHC.Prim.quotInt8#", "GHC.Internal.Prim.quotInt8#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.remInt8#", "GHC.Internal.Prim.remInt8#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemInt8#", "GHC.Internal.Prim.quotRemInt8#"]
    kind: Declaration
    template: |-
      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftLInt8#", "GHC.Internal.Prim.uncheckedShiftLInt8#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRAInt8#", "GHC.Internal.Prim.uncheckedShiftRAInt8#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftR][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_right(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRLInt8#", "GHC.Internal.Prim.uncheckedShiftRLInt8#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftRL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= ~ARG[0] srl ~SYM[1]
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.int8ToWord8#", "GHC.Internal.Prim.int8ToWord8#"]
    kind: Expression
    template: unsigned(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.eqInt8#", "GHC.Internal.Prim.eqInt8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geInt8#", "GHC.Internal.Prim.geInt8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.gtInt8#", "GHC.Internal.Prim.gtInt8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leInt8#", "GHC.Internal.Prim.leInt8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltInt8#", "GHC.Internal.Prim.ltInt8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neInt8#", "GHC.Internal.Prim.neInt8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.word8ToWord#", "GHC.Internal.Prim.word8ToWord#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.wordToWord8#", "GHC.Internal.Prim.wordToWord8#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.timesWord8#", "GHC.Internal.Prim.timesWord8#"]
    kind: Expression
    template: resize(~ARG[0] * ~ARG[1],~SIZE[~TYPO])
- BlackBox:
    name: ["GHC.Prim.quotWord8#", "GHC.Internal.Prim.quotWord8#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.remWord8#", "GHC.Internal.Prim.remWord8#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemWord8#", "GHC.Internal.Prim.quotRemWord8#"]
    kind: Declaration
    template: |-
      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.andWord8#", "GHC.Internal.Prim.andWord8#"]
    kind: Expression
    template: ~ARG[0] and ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.orWord8#", "GHC.Internal.Prim.orWord8#"]
    kind: Expression
    template: ~ARG[0] or ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.xorWord8#", "GHC.Internal.Prim.xorWord8#"]
    kind: Expression
    template: ~ARG[0] xor ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.notWord8#", "GHC.Internal.Prim.notWord8#"]
    kind: Expression
    template: not ~ARG[0]
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftLWord8#", "GHC.Internal.Prim.uncheckedShiftLWord8#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRLWord8#", "GHC.Internal.Prim.uncheckedShiftRLWord8#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftRL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= ~ARG[0] srl ~SYM[1]
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.word8ToInt8#", "GHC.Internal.Prim.word8ToInt8#"]
    kind: Expression
    template: signed(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.eqWord8#", "GHC.Internal.Prim.eqWord8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geWord8#", "GHC.Internal.Prim.geWord8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.gtWord8#", "GHC.Internal.Prim.gtWord8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leWord8#", "GHC.Internal.Prim.leWord8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltWord8#", "GHC.Internal.Prim.ltWord8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neWord8#", "GHC.Internal.Prim.neWord8#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.int16ToInt#", "GHC.Internal.Prim.int16ToInt#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.intToInt16#", "GHC.Internal.Prim.intToInt16#"]
    kind: Expression
    template: ~VAR[i][0](15 downto 0)
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.negateInt16#", "GHC.Internal.Prim.negateInt16#"]
    kind: Expression
    template: -~ARG[0]
- BlackBox:
    name: ["GHC.Prim.timesInt16#", "GHC.Internal.Prim.timesInt16#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_mult][0] : block
        signal ~GENSYM[~RESULT_mult_full][1] : signed(~SIZE[~TYPO]*2-1 downto 0);
      begin
        ~SYM[1] <= ~ARG[0] * ~ARG[1];
        ~RESULT <= ~SYM[1](~SIZE[~TYPO]-1 downto 0);
      end block;
- BlackBox:
    name: ["GHC.Prim.quotInt16#", "GHC.Internal.Prim.quotInt16#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.remInt16#", "GHC.Internal.Prim.remInt16#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemInt16#", "GHC.Internal.Prim.quotRemInt16#"]
    kind: Declaration
    template: |-
      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftLInt16#", "GHC.Internal.Prim.uncheckedShiftLInt16#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRAInt16#", "GHC.Internal.Prim.uncheckedShiftRAInt16#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftR][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_right(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRLInt16#", "GHC.Internal.Prim.uncheckedShiftRLInt16#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftRL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= ~ARG[0] srl ~SYM[1]
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.int16ToWord16#", "GHC.Internal.Prim.int16ToWord16#"]
    kind: Expression
    template: unsigned(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.eqInt16#", "GHC.Internal.Prim.eqInt16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geInt16#", "GHC.Internal.Prim.geInt16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.gtInt16#", "GHC.Internal.Prim.gtInt16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leInt16#", "GHC.Internal.Prim.leInt16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltInt16#", "GHC.Internal.Prim.ltInt16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neInt16#", "GHC.Internal.Prim.neInt16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.word16ToWord#", "GHC.Internal.Prim.word16ToWord#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.wordToWord16#", "GHC.Internal.Prim.wordToWord16#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.timesWord16#", "GHC.Internal.Prim.timesWord16#"]
    kind: Expression
    template: resize(~ARG[0] * ~ARG[1],~SIZE[~TYPO])
- BlackBox:
    name: ["GHC.Prim.quotWord16#", "GHC.Internal.Prim.quotWord16#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.remWord16#", "GHC.Internal.Prim.remWord16#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemWord16#", "GHC.Internal.Prim.quotRemWord16#"]
    kind: Declaration
    template: |-
      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.andWord16#", "GHC.Internal.Prim.andWord16#"]
    kind: Expression
    template: ~ARG[0] and ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.orWord16#", "GHC.Internal.Prim.orWord16#"]
    kind: Expression
    template: ~ARG[0] or ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.xorWord16#", "GHC.Internal.Prim.xorWord16#"]
    kind: Expression
    template: ~ARG[0] xor ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.notWord16#", "GHC.Internal.Prim.notWord16#"]
    kind: Expression
    template: not ~ARG[0]
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftLWord16#", "GHC.Internal.Prim.uncheckedShiftLWord16#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRLWord16#", "GHC.Internal.Prim.uncheckedShiftRLWord16#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftRL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= ~ARG[0] srl ~SYM[1]
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.word16ToInt16#", "GHC.Internal.Prim.word16ToInt16#"]
    kind: Expression
    template: signed(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.eqWord16#", "GHC.Internal.Prim.eqWord16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geWord16#", "GHC.Internal.Prim.geWord16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.gtWord16#", "GHC.Internal.Prim.gtWord16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leWord16#", "GHC.Internal.Prim.leWord16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltWord16#", "GHC.Internal.Prim.ltWord16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neWord16#", "GHC.Internal.Prim.neWord16#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.int32ToInt#", "GHC.Internal.Prim.int32ToInt#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.intToInt32#", "GHC.Internal.Prim.intToInt32#"]
    kind: Expression
    template: ~VAR[i][0](31 downto 0)
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.negateInt32#", "GHC.Internal.Prim.negateInt32#"]
    kind: Expression
    template: -~ARG[0]
- BlackBox:
    name: ["GHC.Prim.timesInt32#", "GHC.Internal.Prim.timesInt32#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_mult][0] : block
        signal ~GENSYM[~RESULT_mult_full][1] : signed(~SIZE[~TYPO]*2-1 downto 0);
      begin
        ~SYM[1] <= ~ARG[0] * ~ARG[1];
        ~RESULT <= ~SYM[1](~SIZE[~TYPO]-1 downto 0);
      end block;
- BlackBox:
    name: ["GHC.Prim.quotInt32#", "GHC.Internal.Prim.quotInt32#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.remInt32#", "GHC.Internal.Prim.remInt32#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemInt32#", "GHC.Internal.Prim.quotRemInt32#"]
    kind: Declaration
    template: |-
      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftLInt32#", "GHC.Internal.Prim.uncheckedShiftLInt32#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRAInt32#", "GHC.Internal.Prim.uncheckedShiftRAInt32#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftR][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_right(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRLInt32#", "GHC.Internal.Prim.uncheckedShiftRLInt32#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftRL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= ~ARG[0] srl ~SYM[1]
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.int32ToWord32#", "GHC.Internal.Prim.int32ToWord32#"]
    kind: Expression
    template: unsigned(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.eqInt32#", "GHC.Internal.Prim.eqInt32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geInt32#", "GHC.Internal.Prim.geInt32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.gtInt32#", "GHC.Internal.Prim.gtInt32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leInt32#", "GHC.Internal.Prim.leInt32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltInt32#", "GHC.Internal.Prim.ltInt32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neInt32#", "GHC.Internal.Prim.neInt32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.word32ToWord#", "GHC.Internal.Prim.word32ToWord#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.wordToWord32#", "GHC.Internal.Prim.wordToWord32#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.timesWord32#", "GHC.Internal.Prim.timesWord32#"]
    kind: Expression
    template: resize(~ARG[0] * ~ARG[1],~SIZE[~TYPO])
- BlackBox:
    name: ["GHC.Prim.quotWord32#", "GHC.Internal.Prim.quotWord32#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.remWord32#", "GHC.Internal.Prim.remWord32#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemWord32#", "GHC.Internal.Prim.quotRemWord32#"]
    kind: Declaration
    template: |-
      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.andWord32#", "GHC.Internal.Prim.andWord32#"]
    kind: Expression
    template: ~ARG[0] and ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.orWord32#", "GHC.Internal.Prim.orWord32#"]
    kind: Expression
    template: ~ARG[0] or ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.xorWord32#", "GHC.Internal.Prim.xorWord32#"]
    kind: Expression
    template: ~ARG[0] xor ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.notWord32#", "GHC.Internal.Prim.notWord32#"]
    kind: Expression
    template: not ~ARG[0]
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftLWord32#", "GHC.Internal.Prim.uncheckedShiftLWord32#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRLWord32#", "GHC.Internal.Prim.uncheckedShiftRLWord32#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftRL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= ~ARG[0] srl ~SYM[1]
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.word32ToInt32#", "GHC.Internal.Prim.word32ToInt32#"]
    kind: Expression
    template: signed(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.eqWord32#", "GHC.Internal.Prim.eqWord32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geWord32#", "GHC.Internal.Prim.geWord32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.gtWord32#", "GHC.Internal.Prim.gtWord32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leWord32#", "GHC.Internal.Prim.leWord32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltWord32#", "GHC.Internal.Prim.ltWord32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neWord32#", "GHC.Internal.Prim.neWord32#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.int64ToInt#", "GHC.Internal.Prim.int64ToInt#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.intToInt64#", "GHC.Internal.Prim.intToInt64#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.negateInt64#", "GHC.Internal.Prim.negateInt64#"]
    kind: Expression
    template: -~ARG[0]
- BlackBox:
    name: ["GHC.Prim.timesInt64#", "GHC.Internal.Prim.timesInt64#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_mult][0] : block
        signal ~GENSYM[~RESULT_mult_full][1] : signed(~SIZE[~TYPO]*2-1 downto 0);
      begin
        ~SYM[1] <= ~ARG[0] * ~ARG[1];
        ~RESULT <= ~SYM[1](~SIZE[~TYPO]-1 downto 0);
      end block;
- BlackBox:
    name: ["GHC.Prim.quotInt64#", "GHC.Internal.Prim.quotInt64#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.remInt64#", "GHC.Internal.Prim.remInt64#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemInt64#", "GHC.Internal.Prim.quotRemInt64#"]
    kind: Declaration
    template: |-
      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.uncheckedIShiftL64#", "GHC.Internal.Prim.uncheckedIShiftL64#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedIShiftRA64#", "GHC.Internal.Prim.uncheckedIShiftRA64#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftR][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_right(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedIShiftRL64#", "GHC.Internal.Prim.uncheckedIShiftRL64#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftRL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= ~ARG[0] srl ~SYM[1]
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.int64ToWord64#", "GHC.Internal.Prim.int64ToWord64#"]
    kind: Expression
    template: unsigned(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.eqInt64#", "GHC.Internal.Prim.eqInt64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geInt64#", "GHC.Internal.Prim.geInt64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.gtInt64#", "GHC.Internal.Prim.gtInt64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leInt64#", "GHC.Internal.Prim.leInt64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltInt64#", "GHC.Internal.Prim.ltInt64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neInt64#", "GHC.Internal.Prim.neInt64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.word64ToWord#", "GHC.Internal.Prim.word64ToWord#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.wordToWord64#", "GHC.Internal.Prim.wordToWord64#"]
    kind: Expression
    template: resize(~ARG[0],~SIZE[~TYPO])
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.timesWord64#", "GHC.Internal.Prim.timesWord64#"]
    kind: Expression
    template: resize(~ARG[0] * ~ARG[1],~SIZE[~TYPO])
- BlackBox:
    name: ["GHC.Prim.quotWord64#", "GHC.Internal.Prim.quotWord64#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] / ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.remWord64#", "GHC.Internal.Prim.remWord64#"]
    kind: Declaration
    template: |-
      ~RESULT <= ~ARG[0] rem ~ARG[1]
          -- pragma translate_off
          when (~ARG[1] /= 0) else (others => 'X')
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.quotRemWord64#", "GHC.Internal.Prim.quotRemWord64#"]
    kind: Declaration
    template: |-
      ~RESULT <= (~ARG[0] / ~ARG[1], ~ARG[0] rem ~ARG[1])
          -- pragma translate_off
          when (~ARG[1] /= 0) else ((others => 'X'), (others => 'X'))
          -- pragma translate_on
          ;
- BlackBox:
    name: ["GHC.Prim.and64#", "GHC.Internal.Prim.and64#"]
    kind: Expression
    template: ~ARG[0] and ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.or64#", "GHC.Internal.Prim.or64#"]
    kind: Expression
    template: ~ARG[0] or ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.xor64#", "GHC.Internal.Prim.xor64#"]
    kind: Expression
    template: ~ARG[0] xor ~ARG[1]
- BlackBox:
    name: ["GHC.Prim.not64#", "GHC.Internal.Prim.not64#"]
    kind: Expression
    template: not ~ARG[0]
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftL64#", "GHC.Internal.Prim.uncheckedShiftL64#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= shift_left(~ARG[0],~SYM[1])
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.uncheckedShiftRL64#", "GHC.Internal.Prim.uncheckedShiftRL64#"]
    kind: Declaration
    template: |-
      ~GENSYM[~RESULT_shiftRL][0] : block
        signal ~GENSYM[sh][1] : natural;
      begin
        ~SYM[1] <=
            -- pragma translate_off
            natural'high when (~VAR[shI][1](~SIZE[~TYP[1]]-1 downto 31) /= 0) else
            -- pragma translate_on
            to_integer(~VAR[shI][1]);
        ~RESULT <= ~ARG[0] srl ~SYM[1]
            -- pragma translate_off
            when (~ARG[1] >= 0) else (others => 'X')
            -- pragma translate_on
            ;
      end block;
- BlackBox:
    name: ["GHC.Prim.word64ToInt64#", "GHC.Internal.Prim.word64ToInt64#"]
    kind: Expression
    template: signed(std_logic_vector(~ARG[0]))
    workInfo: Never
- BlackBox:
    name: ["GHC.Prim.eqWord64#", "GHC.Internal.Prim.eqWord64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] = ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.geWord64#", "GHC.Internal.Prim.geWord64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] >= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.gtWord64#", "GHC.Internal.Prim.gtWord64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] > ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.leWord64#", "GHC.Internal.Prim.leWord64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] <= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.ltWord64#", "GHC.Internal.Prim.ltWord64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] < ~ARG[1] else to_signed(0,~SIZE[~TYPO]);
- BlackBox:
    name: ["GHC.Prim.neWord64#", "GHC.Internal.Prim.neWord64#"]
    kind: Declaration
    template: ~RESULT <= to_signed(1,~SIZE[~TYPO]) when ~ARG[0] /= ~ARG[1] else to_signed(0,~SIZE[~TYPO]);