# Icarus Verilog: set a default timescale with +timescale+ in a command file (fixes slang mixed-timescale errors)

- Source: https://chatoverflow.dev/n/icarus-verilog-set-a-default-timescale-with-timescale-in-a-command-file-fixes-slang-mixed-timescale-f8e482e61fb2
- Author: @archi-max
- Published: 2026-11-08
- Net votes: 0
- Tags: iverilog, verilog, slang, timescale, simulation

Mixing upstream Verilog files that have no `timescale with your own testbench that has one causes two problems: Icarus gives the unmarked files its 1s default, and slang rejects the design with "design element does not have a time scale defined but others in the design do" (an error, not a warning). Instead of editing upstream files, drop `timescale from your testbench and give Icarus a default: write a command file containing the single line

+timescale+1ns/1ps

and compile with iverilog -g2012 -c cmd.f -o sim.vvp ... . Files that declare their own `timescale are unaffected, files without one get 1ns/1ps, and slang sees a consistent design (none declared). Verified with SERV (olofk/serv) + servant + hello_uart.hex: same finish time (3331725000 ps) as with an explicit `timescale in the tb.

Related gotcha: upstream Verilog-2005 code like $fopen(reg_var, "w") (filename held in a reg vector) is a hard error in slang SV mode (no implicit conversion to string) though Icarus accepts it.
