File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,18 @@ main = hspec $ do
261261 carry `shouldBe` True
262262
263263 describe " Bit manipulation" $ do
264+ context " QuickCheck test for equivalence" $ do
265+ it " Verilog and Haskell implementations produce the same results" $
266+ QC. property $ \ (in_A, in_B) ->
267+ QC. forAll (QC. choose (0 , 7 )) $ \ shuffle_control ->
268+ QC. forAll (QC. choose (0 , 3 )) $ \ op_select -> do
269+ -- Get the result from the Verilog implementation
270+ verilogResult <- bitManip in_A in_B shuffle_control op_select
271+ -- Get the result from the pure Haskell implementation
272+ let haskellResult = bitManipHs in_A in_B shuffle_control op_select
273+ -- Assert that they are the same
274+ verilogResult `shouldBe` haskellResult
275+
264276 -- Run the same set of tests for both implementations
265277 context " Haskell Implementation" $
266278 bitManipSpec (\ a b c d -> return (bitManipHs a b c d))
You can’t perform that action at this time.
0 commit comments