Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/2025-09-05T19_03_39+02_00_implicit_nets
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGED: when generating (System)Verilog, Clash now resets the default net type from none to the verilog default after the generated module
9 changes: 6 additions & 3 deletions clash-lib/src/Clash/Backend/SystemVerilog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,17 @@ genSystemVerilog opts _ sp seen us c = do
where
cName = componentName c
verilog = commentHeader <> line <>
nettype <> line <>
nettypeNone <> line <>
timescale <> line <>
module_ c
module_ c <> line <>
nettypeDefault

commentHeader
= "/* AUTOMATICALLY GENERATED SYSTEMVERILOG-2005 SOURCE CODE."
<> line <> "** GENERATED BY CLASH " <> string (Text.pack clashVer) <> ". DO NOT MODIFY."
<> line <> "*/"
nettype = "`default_nettype none"
nettypeNone = "`default_nettype none"
nettypeDefault = "`default_nettype wire"
timescale = "`timescale 100fs/" <> string (Text.pack precision)
precision = periodToString (opt_timescalePrecision opts)

Expand Down
9 changes: 7 additions & 2 deletions clash-lib/src/Clash/Backend/Verilog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ genVerilog opts _ sp seen usage c = do
usages .= usage
setSrcSpan sp

v <- commentHeader <> line <> nettype <> line <> timescale <> line <> module_ c
v <- commentHeader <> line <>
nettypeNone <> line <>
timescale <> line <>
module_ c <> line <>
nettypeDefault
incs <- Ap $ use includes
return ((TextS.unpack (Id.toText cName), v), incs)
where
Expand All @@ -234,7 +238,8 @@ genVerilog opts _ sp seen usage c = do
= "/* AUTOMATICALLY GENERATED VERILOG-2001 SOURCE CODE."
<> line <> "** GENERATED BY CLASH " <> string (Text.pack clashVer) <> ". DO NOT MODIFY."
<> line <> "*/"
nettype = "`default_nettype none"
nettypeNone = "`default_nettype none"
nettypeDefault = "`default_nettype wire"
timescale = "`timescale 100fs/" <> string (Text.pack precision)
precision = periodToString (opt_timescalePrecision opts)

Expand Down
Loading