Skip to content

Simple design fails to compile #364

Closed
@adamwalker

Description

@adamwalker

Using Clash 0.99.3, compilation of the design below fails with the error:

<no location info>: error:
    Clash error call:
    Clash.Normalize(189): Expr belonging to bndr: x1536 not found
module Mod where

import Clash.Prelude

func
    :: BitVector 8
    -> BitVector 8
    -> BitVector 32
func d c
    | c == 0    = resize d
    | otherwise = 0

mod'
    :: forall dom gated sync. HiddenClockReset dom gated sync
    => Signal dom (BitVector 32)
mod' = o
    where

    x :: Signal dom (BitVector 8) = pure 0 
    y :: Signal dom (BitVector 8) = (+1) <$> z
    z :: Signal dom (BitVector 8) = pure 0

    f :: Signal dom (BitVector 8) -> Signal dom (BitVector 32)
    f = foldl1 (\x y o -> liftA2 (.|.) (x o) (y o)) 
        $  liftA2 func x
        :> liftA2 func y
        :> liftA2 func z
        :> Nil

    o = f (pure 0)

topEntity clk rst = withClockReset @System @Source @Synchronous clk rst mod'

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions