What is timescale ? What does timescale 1ns/1ps mean?
What is timescale ? What does timescale 1ns/1ps mean?
Model answer
Syntax: timescale <time_unit>/<time_precision> - **time_unit:** unit of every delay written in the module ( #1 = 1 unit). - **time_precision:** smallest step the simulator uses; delays are **rounded** to it. timescale 1ns/1ps : delays are in ns, resolved to 1 ps. Example: delays #0.45; #0.50; #0.55; with $realtime printed using %0t : {|l|c|c|c|c|}\hline Timescale & t_0 & t_1 & t_2 & t_3\\ \hline 1ns/1ns & 0 & 0 & 1 & 2\\ \hline 1ns/1ps (in ps) & 0 & 450 & 950 & 1500\\ \hline 10ns/1ns & 0 & 5 & 10 & 16\\ \hline Reasoning: - 1ns/1ns : precision 1 ns, so 0.45 → 0, 0.50 → 1, 0.55 → 1 (rounded to nearest integer ns). - 1ns/1ps : precision 1 ps, nothing is lost: 0.45, 0.95, 1.50 ns. - 10ns/1ns : delays are multiplied by 10 ns first: $4.5 \to 5$, $5.0 \to 5$, $5.5 \to 6$ ns, cumulative $5, 10, 16$. The printed unit of %0t depends on $timeformat / simulator default. If no timescale is given, the simulator applies its own default.