packages feed

fir-0.1.0.0: test/Tests/Bits/BitReverse.hs

{-# LANGUAGE BlockArguments   #-}
{-# LANGUAGE DataKinds        #-}
{-# LANGUAGE NamedWildCards   #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE PolyKinds        #-}
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators    #-}

module Tests.Bits.BitReverse where

-- fir
import FIR

------------------------------------------------
-- program

type Defs = '[ "x"    ':-> Input  '[Location 0] Word32
             , "out"  ':-> Output '[Location 0] Word32
             , "main" ':-> EntryPoint '[] Vertex
             ]

program :: Module Defs
program = Module $ entryPoint @"main" @Vertex do

    x <- get @"x"

    put @"out" $ bitReverse x `xor` bitReverse ( Lit 0x80000001 )