aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/Reduce.hs
blob: e393e51eb33e06f99ece69923b606d2736c2df8b (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
26
27
28
{-|
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)