SlideShare a Scribd company logo
1
Verilog HDLVerilog HDL
ASIC DESIGN USING
FPGA
BEIT VII
KICSIT
Oct 8 2012 Lecture 17
2
Initializing Memory from File
Oct 8 2012
• Verilog provides a very useful system task to
initialize memories from a data file.
• Two tasks are provided to read numbers in binary
or hexadecimal format.
• Keywords $readmemb and $readmemh are
used to initialize memories.
Lecture 17
3
Initializing Memory from File
Oct 8 2012
• Usage:
$readmemb("<file_name>", <memory_name>);
$readmemb("<file_name>", <memory_name>,
<start_addr>);
$readmemb("<file_name>", <memory_name>,
<start_addr>,<finish_addr>);
• Identical syntax for $readmemh.
Lecture 17
4
Initializing Memory from File
Oct 8 2012
• The <file_name> and <memory_name> are
mandatory; <start_addr> and <finish_addr> are
optional.
• Defaults are start index of memory array for
<start_addr> and end of the data file or memory for
<finish_addr>.
Lecture 17
5
Initializing Memory from File
Oct 8 2012
• Example
Lecture 17
6
Strobing
Oct 8 2012
• Strobing is done with the system task keyword
$strobe.
• This task is very similar to the $display task
except for a slight difference.
• If many other statements are executed in the same
time unit as the $display task, the order of
execution is nondeterministic.
Lecture 17
7
Strobing
Oct 8 2012
• If $strobe is used, it is always executed after
all other assignment statements in the same time
unit have executed.
• Thus, $strobe provides a synchronization
mechanism to ensure that data is displayed only
after all other assignment statements, which change
the data in that time step, have executed.
Lecture 17
8
Strobing
Oct 8 2012
• Example
Lecture 17
9
Strobing
Oct 8 2012
• In this example the values at positive edge of
clock will be displayed only after statements a = b
and c = d execute.
• If $display was used, $display might
execute before statements a = b and c = d, thus
displaying different values.
Lecture 17
10
Random Number Generation
Oct 8 2012
• Random number generation is required for a
random set of test vectors.
• Random testing is important because it often
catches hidden bugs in the design.
• Random vector generation is also used in
performance analysis of chip architectures.
• The system task $random is used for generating
a random number.
Lecture 17
11
Random Number Generation
Oct 8 2012
• Usage:
$random;
$random(<seed>);
• The value of <seed> is optional and is used to
ensure the same random number sequence each
time the test is run.
Lecture 17
12
Random Number Generation
Oct 8 2012
• Example
Lecture 17

More Related Content

PPTX
20090109 Dsl2cpp Md Workbench
PPTX
Synapse india dotnet development overloading operater part 3
PPTX
Header files of c++ unit 3 -topic 3
PPTX
Reactive Extensions (Rx)
PPT
22nd Lecture
PPT
18th & 19th Lecture
PPTX
Factory method & strategy pattern
PPT
Mobile comm. 2
20090109 Dsl2cpp Md Workbench
Synapse india dotnet development overloading operater part 3
Header files of c++ unit 3 -topic 3
Reactive Extensions (Rx)
22nd Lecture
18th & 19th Lecture
Factory method & strategy pattern
Mobile comm. 2

Viewers also liked (14)

PPTX
Factory method, strategy pattern & chain of responsibilities
PPT
02 psychovisual perception DIP
PPT
35th 36th Lecture
PPT
Assic 8th Lecture
PPT
01 introduction DIP
PPT
Interrupt1
PPTX
Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modeling
DOC
22 microcontroller programs
PPTX
Beit 381 se lec 13 - 11 - 12 mar20 - project management
PPT
Assic 23rd Lecture Part 2
PPT
03 digital image fundamentals DIP
PPT
Java IO Package and Streams
PPT
Lecture9 Signal and Systems
PPT
Lecture2 Signal and Systems
Factory method, strategy pattern & chain of responsibilities
02 psychovisual perception DIP
35th 36th Lecture
Assic 8th Lecture
01 introduction DIP
Interrupt1
Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modeling
22 microcontroller programs
Beit 381 se lec 13 - 11 - 12 mar20 - project management
Assic 23rd Lecture Part 2
03 digital image fundamentals DIP
Java IO Package and Streams
Lecture9 Signal and Systems
Lecture2 Signal and Systems
Ad

Similar to Assic 17th Lecture (20)

PDF
GOTO 2013: Why Zalando trusts in PostgreSQL
PDF
Tuning parallelcodeonsolaris005
PDF
Zend Server Data Caching
PDF
Linux Shell Scripting Craftsmanship
PDF
PDF
6 tips for improving ruby performance
PDF
Rails Tips and Best Practices
PDF
Testing Persistent Storage Performance in Kubernetes with Sherlock
PPTX
Tips, Tricks & Best Practices for large scale HDInsight Deployments
PDF
Compile ahead of time. It's fine?
PPTX
Mongo db v3_deep_dive
PPTX
MySQL Optimizer: What's New in 8.0
PPT
Php classes in mumbai
PDF
0396 oracle-goldengate-12c-tutorial
PDF
Terence Barr - jdk7+8 - 24mai2011
PDF
Verilog HDL coding in VLSi Design circuits.pdf
PDF
Tutorial On Database Management System
PPTX
Use Data-Oriented Design to write efficient code
PPT
Fpga 06-data-types-system-tasks-compiler-directives
PPTX
Keeping Your Java Hot by Solving the JVM Warmup Problem
GOTO 2013: Why Zalando trusts in PostgreSQL
Tuning parallelcodeonsolaris005
Zend Server Data Caching
Linux Shell Scripting Craftsmanship
6 tips for improving ruby performance
Rails Tips and Best Practices
Testing Persistent Storage Performance in Kubernetes with Sherlock
Tips, Tricks & Best Practices for large scale HDInsight Deployments
Compile ahead of time. It's fine?
Mongo db v3_deep_dive
MySQL Optimizer: What's New in 8.0
Php classes in mumbai
0396 oracle-goldengate-12c-tutorial
Terence Barr - jdk7+8 - 24mai2011
Verilog HDL coding in VLSi Design circuits.pdf
Tutorial On Database Management System
Use Data-Oriented Design to write efficient code
Fpga 06-data-types-system-tasks-compiler-directives
Keeping Your Java Hot by Solving the JVM Warmup Problem
Ad

More from babak danyal (20)

DOCX
applist
PPT
Easy Steps to implement UDP Server and Client Sockets
PPT
Swing and Graphical User Interface in Java
PPT
Tcp sockets
PPTX
block ciphers and the des
PPT
key distribution in network security
PPT
Lecture10 Signal and Systems
PPT
Lecture8 Signal and Systems
PPT
Lecture7 Signal and Systems
PPT
Lecture6 Signal and Systems
PPT
Lecture5 Signal and Systems
PPT
Lecture4 Signal and Systems
PPT
Lecture3 Signal and Systems
PPT
Lecture1 Intro To Signa
PPT
Lecture9
PPT
Cns 13f-lec03- Classical Encryption Techniques
PPT
Classical Encryption Techniques in Network Security
DOCX
Problems at independence
DOCX
Quaid-e-Azam and Early Problems of Pakistan
DOCX
Aligarh movement new
applist
Easy Steps to implement UDP Server and Client Sockets
Swing and Graphical User Interface in Java
Tcp sockets
block ciphers and the des
key distribution in network security
Lecture10 Signal and Systems
Lecture8 Signal and Systems
Lecture7 Signal and Systems
Lecture6 Signal and Systems
Lecture5 Signal and Systems
Lecture4 Signal and Systems
Lecture3 Signal and Systems
Lecture1 Intro To Signa
Lecture9
Cns 13f-lec03- Classical Encryption Techniques
Classical Encryption Techniques in Network Security
Problems at independence
Quaid-e-Azam and Early Problems of Pakistan
Aligarh movement new

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
cuic standard and advanced reporting.pdf
PPT
Teaching material agriculture food technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
Machine learning based COVID-19 study performance prediction
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Unlocking AI with Model Context Protocol (MCP)
Reach Out and Touch Someone: Haptics and Empathic Computing
gpt5_lecture_notes_comprehensive_20250812015547.pdf
A Presentation on Artificial Intelligence
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
NewMind AI Weekly Chronicles - August'25-Week II
Network Security Unit 5.pdf for BCA BBA.
sap open course for s4hana steps from ECC to s4
Chapter 3 Spatial Domain Image Processing.pdf
cuic standard and advanced reporting.pdf
Teaching material agriculture food technology
Empathic Computing: Creating Shared Understanding
Machine learning based COVID-19 study performance prediction
Assigned Numbers - 2025 - Bluetooth® Document
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MIND Revenue Release Quarter 2 2025 Press Release
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx

Assic 17th Lecture

  • 1. 1 Verilog HDLVerilog HDL ASIC DESIGN USING FPGA BEIT VII KICSIT Oct 8 2012 Lecture 17
  • 2. 2 Initializing Memory from File Oct 8 2012 • Verilog provides a very useful system task to initialize memories from a data file. • Two tasks are provided to read numbers in binary or hexadecimal format. • Keywords $readmemb and $readmemh are used to initialize memories. Lecture 17
  • 3. 3 Initializing Memory from File Oct 8 2012 • Usage: $readmemb("<file_name>", <memory_name>); $readmemb("<file_name>", <memory_name>, <start_addr>); $readmemb("<file_name>", <memory_name>, <start_addr>,<finish_addr>); • Identical syntax for $readmemh. Lecture 17
  • 4. 4 Initializing Memory from File Oct 8 2012 • The <file_name> and <memory_name> are mandatory; <start_addr> and <finish_addr> are optional. • Defaults are start index of memory array for <start_addr> and end of the data file or memory for <finish_addr>. Lecture 17
  • 5. 5 Initializing Memory from File Oct 8 2012 • Example Lecture 17
  • 6. 6 Strobing Oct 8 2012 • Strobing is done with the system task keyword $strobe. • This task is very similar to the $display task except for a slight difference. • If many other statements are executed in the same time unit as the $display task, the order of execution is nondeterministic. Lecture 17
  • 7. 7 Strobing Oct 8 2012 • If $strobe is used, it is always executed after all other assignment statements in the same time unit have executed. • Thus, $strobe provides a synchronization mechanism to ensure that data is displayed only after all other assignment statements, which change the data in that time step, have executed. Lecture 17
  • 8. 8 Strobing Oct 8 2012 • Example Lecture 17
  • 9. 9 Strobing Oct 8 2012 • In this example the values at positive edge of clock will be displayed only after statements a = b and c = d execute. • If $display was used, $display might execute before statements a = b and c = d, thus displaying different values. Lecture 17
  • 10. 10 Random Number Generation Oct 8 2012 • Random number generation is required for a random set of test vectors. • Random testing is important because it often catches hidden bugs in the design. • Random vector generation is also used in performance analysis of chip architectures. • The system task $random is used for generating a random number. Lecture 17
  • 11. 11 Random Number Generation Oct 8 2012 • Usage: $random; $random(<seed>); • The value of <seed> is optional and is used to ensure the same random number sequence each time the test is run. Lecture 17
  • 12. 12 Random Number Generation Oct 8 2012 • Example Lecture 17