aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/Reduce.hs
blob: 47cdcaced3af62de3e516d6ec9d95fd4e09ab694 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-|
Module      : VeriFuzz.Reduce
Description : Test case reducer implementation.
Copyright   : (c) 2019, Yann Herklotz Grave
License     : GPL-3
Maintainer  : ymherklotz [at] gmail [dot] com
Stability   : experimental
Portability : POSIX

Test case reducer implementation.
-}

module VeriFuzz.Reduce where

import           Control.Lens
import           VeriFuzz.AST

halve :: [a] -> ([a], [a])
halve l = splitAt (length l `div` 2) l

removeUninitWires :: [ModItem] -> [ModItem]
removeUninitWires ms = ms where ids = ms ^.. traverse . modContAssign . contAssignNetLVal

halveModDecl :: ModDecl -> (ModDecl, ModDecl)
halveModDecl m = (m & modItems %~ fst . halve, m & modItems %~ snd . halve)