In this post, let us see the timescale feature and system tasks that are available in Verilog HDL with brief examples.
`timescale directive specifies the time unit and time precision of the modules that follow it. The time unit is the unit of measurement for time values such as the simulation time and delay values.
Syntax: `timescale <time_unit>/<time_precision>
The time_unit argument specifies the unit of measurement for times and delays.
The time_precision argument specifies how delay values are rounded before being used in simulation. The smallest time_precision argument of all the 'timescale compiler directives in the design determines the precision of the time unit of the simulation.
The time_precision argument shall be at least as precise as the time_unit argument; it cannot specify a longer unit of time than time_unit. The integers in these arguments specify an order of magnitude for the size of the value; the valid integers are 1, 10, and 100. The character strings "s, ms, us, ns, ps, and fs " represent units of measurement;
Example: `timescale 1ns/100ps
Here in the above example, time_unit is 1ns & time_precision is 100ps. So the delay of #1 in the code is equivalent to 1ns delay in simulation. The delay of #1.56 will be rounded to 1.6ns. i.e. the decimal fraction will be rounded to in multiples of the time_precision value. Each #delay value is rounded to time delays w.r.t the timescale specified and added to the current simulation time.
Some of the system tasks on timescale are
· $printtimescale() prints the timescale settings of the current scope of the file.
· $timeformat(..,..,,,) system task
The $timeformat system task performs the following two operations:
Ø It sets the time unit for all later-entered delays entered interactively.
Ø It sets the time unit, precision number, suffix string, and minimum field width for all %t formats specified in all modules that follow in the source description until another $timeformat system task is invoked.
Syntax for $timeformat is
$timeformat ( units_number , precision_number , suffix_string , minimum_field_width ) ;
Example: $timeformat(-9,3,"ns",8); This will display any %t string in ns with 3 digits precision, and 8 characters string size.
Let us see the code for the example used for different timescale settings & $timeformat system task.
initial begin
$timeformat(-9,3,"ns",8);
#1 $display("\n1) %t",$realtime);
#10.5 $display("\n2) %t",$realtime);
#10.56 $display("\n3) %t",$realtime);
#10.56 $display("\n4) %t",$realtime);
#11.46 $display("\n5) %t",$realtime);
$finish;
end
The output of the above code with different timescale values are illustrated in the below table.
Timescale
|
`timescale 1ns/1ps
|
`timescale 1ns/10ps
|
`timescale 1ns/100ps
|
Output
|
1) 1.000ns
2) 11.500ns
3) 22.060ns
4) 32.620ns
5) 44.080ns
|
1) 1.000ns
2) 11.500ns
3) 22.060ns
4) 32.620ns
5) 44.080ns
|
1) 1.000ns
2) 11.500ns
3) 22.100ns
4) 32.700ns
5) 44.200ns
|
The calculation for timescale 1ns/100ps is as below:
1. Step 1, time is 1ns
2. Step 2, time is (1ns+10.5ns)=11.5ns
3. Step 3, time is (11.5ns + 10.6ns) = 22.1ns
4. Step 4, time is (22.1ns + 10.6ns) = 32.7ns
5. Step 5, time is (32.7ns + 11.5ns) = 44.2ns
Similarly you could calculate for different timescale values. If you've any queries, plz do comment it.
If you enjoyed this post plz let us know your views via comments.
This helps us to do much more better.
Thankyou.
I'm extremely inspired with your writing talents and also with the format to your blog. Is that this a paid topic or did you modify it your self? Anyway stay up the nice quality writing, it is uncommon to see a nice weblog like this one these days.. gmail.com login
ReplyDeleteThink of them as being a store which will buy a large quantity of items, getting a significant bulk discount, and after that offer the same items for your requirements individually for a higher price. mortgage payment calculator canada The most significant factor affecting your monthly mortgage payment is the monthly interest. mortgage payment calculator
ReplyDeleteI was looking at some of your posts on this website and I conceive this web site is really instructive! Keep putting up.. Delay and Reverb Calculator
ReplyDeleteyurtdışı kargo
ReplyDeleteresimli magnet
instagram takipçi satın al
yurtdışı kargo
sms onay
dijital kartvizit
dijital kartvizit
https://nobetci-eczane.org/
NFİ77
https://bayanlarsitesi.com/
ReplyDeleteEskişehir
Erzincan
Ardahan
Erzurum
RW6H8
whatsapp görüntülü show
ReplyDeleteücretli.show
UPHL2G
1FA67
ReplyDeleteÇanakkale Şehir İçi Nakliyat
Tunceli Evden Eve Nakliyat
Kastamonu Parça Eşya Taşıma
Edirne Şehir İçi Nakliyat
Sinop Lojistik
Silivri Cam Balkon
Nevşehir Şehirler Arası Nakliyat
Van Şehirler Arası Nakliyat
Iğdır Şehir İçi Nakliyat
E64FD
ReplyDeleteücretsiz sohbet odaları
mersin ücretsiz sohbet siteleri
tokat mobil sohbet odaları
erzurum sesli mobil sohbet
bursa rastgele görüntülü sohbet uygulamaları
erzurum sohbet
rastgele sohbet
kırşehir sesli sohbet sesli chat
bitlis canlı ücretsiz sohbet
6437A
ReplyDeleteellipal
arculus
web ledger wallet
wallet trust
ledger
eigenlayer wallet
ledger live desktop
web ellipal wallet
trezor suite web
EA143
ReplyDeleteSoundcloud Beğeni Hilesi
Binance Hesap Açma
Onlyfans Takipçi Hilesi
Instagram Beğeni Hilesi
Bee Coin Hangi Borsada
Bitcoin Kazanma
Binance Yaş Sınırı
Wabi Coin Hangi Borsada
Bitcoin Nedir
3F4C9
ReplyDeletekaldıraç nasıl yapılır
binance referans kimliği
referans kod
binance ne demek
en güvenilir kripto borsası
mexc
probit
bitget
referans kimliği nedir
84874
ReplyDeleteücretli show
91EDE
ReplyDeletegörüntülü şov
17AD1BD5C9
ReplyDeleteviga
delay
fx15
bufalo içecek
ücretli şov
görüntülü şov whatsapp numarası
yapay kızlık zarı
skype show
ereksiyon hapı
A07598C306
ReplyDeletegreen temptation
sertleştirici
delay
yapay kızlık zarı
telegram görüntülü şov
viga
whatsapp görüntülü şov
stag
geciktirici
408F9AC89D
ReplyDeletegörüntülü şov
canli web cam show
lady era hap
cialis
delay
green temptation
görüntülü şov whatsapp numarası
lifta
telegram show
CAE2997ECB
ReplyDeleteücretli show