Skip to content

Commit

Permalink
Handle zero-width custom types
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnbastiaan committed Oct 25, 2019
1 parent 2abb2c5 commit 67dc8fb
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions clash-lib/src/Clash/Netlist/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,8 @@ fixCustomRepr reprs (coreToType' -> Right tyName) sum_@(Sum name subtys) =
case getDataRepr tyName reprs of
Just dRepr@(DataRepr' name' size constrs) ->
if length constrs == length subtys then
CustomSum
name
dRepr
(fromIntegral size)
[packSum reprs ty | ty <- subtys]
let cs = CustomSum name dRepr (fromIntegral size) (map (packSum reprs) subtys)
in if size <= 0 then Void (Just cs) else cs
else
error $ $(curLoc) ++ (Text.unpack $ Text.unwords
[ "Type "
Expand All @@ -272,11 +269,8 @@ fixCustomRepr reprs (coreToType' -> Right tyName) sp@(SP name subtys) =
case getDataRepr tyName reprs of
Just dRepr@(DataRepr' name' size constrs) ->
if length constrs == length subtys then
CustomSP
name
dRepr
(fromIntegral size)
[packSP reprs ty | ty <- subtys]
let csp = CustomSP name dRepr (fromIntegral size) (map (packSP reprs) subtys)
in if size <= 0 then Void (Just csp) else csp
else
error $ $(curLoc) ++ (Text.unpack $ Text.unwords
[ "Type "
Expand Down

0 comments on commit 67dc8fb

Please sign in to comment.