Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Verilog
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Hardware description language}} {{Use American English|date = April 2019}} {{Use dmy dates|date=January 2021}} {{Infobox programming language | name = Verilog | logo = | logo caption = | screenshot = | screenshot caption = | file ext = .v, [[header file|.vh]] | paradigm = [[structured programming|Structured]] | released = {{Start date|1984}} | designer = [[Prabhu Goel]], [[Phil Moorby]] and Chi-Lai Huang | developer = [[IEEE]] | discontinued = Merged into [[SystemVerilog]] | latest release version = IEEE 1800-2023 | latest release date = {{start date and age|df=yes|2023|12|6}} | latest preview version = | latest preview date = <!-- {{start date and age|YYYY|MM|DD}} --> | typing = [[Type system|Static]], [[Weak typing|weak]] | implementations = | dialects = [[Verilog-AMS]] | influenced by = [[Pascal (programming language)|Pascal]], [[Ada (programming language)|Ada]], [[C (programming language)|C]], [[Fortran]] | influenced = [[SystemVerilog]] | programming language = | platform = | operating system = | license = | website = https://ieeexplore.ieee.org/document/10458102 | wikibooks = Programmable Logic/Verilog }} '''Verilog''', [[standardized]] as '''IEEE 1364''', is a [[hardware description language]] (HDL) used to model [[electronic system]]s. It is most commonly used in the design and verification of digital circuits, with the highest level of abstraction being at the [[register-transfer level]]. It is also used in the verification of [[Analogue electronics|analog circuits]] and [[Mixed-signal integrated circuit|mixed-signal circuits]], as well as in the design of [[Synthetic biological circuit|genetic circuits]].<ref>{{cite journal |vauthors=Nielsen AA, Der BS, Shin J, Vaidyanathan P, Paralanov V, Strychalski EA, Ross D, Densmore D, Voigt CA |title=Genetic circuit design automation |journal=Science |volume=352 |issue=6281 |pages=aac7341 |year=2016 |pmid=27034378 |doi=10.1126/science.aac7341 |doi-access=free }}</ref> In 2009, the Verilog standard (IEEE 1364-2005) was merged into the [[SystemVerilog]] standard, creating IEEE Standard 1800-2009. Since then, Verilog has been officially part of the SystemVerilog language. The current version is IEEE standard 1800-2023.<ref name="IEEE2023" /> ==Overview== Hardware description languages such as Verilog are similar to [[software]] [[programming language]]s because they include ways of describing the propagation time and signal strengths (sensitivity). There are two types of [[assignment operator]]s; a blocking assignment (=), and a non-blocking (<=) assignment. The non-blocking assignment allows designers to describe a state-machine update without needing to declare and use [[temporary storage variable]]s. Since these concepts are part of Verilog's language semantics, designers could quickly write descriptions of large circuits in a relatively compact and concise form. At the time of Verilog's introduction (1984), Verilog represented a tremendous productivity improvement for circuit designers who were already using graphical [[schematic capture]] software and specially written software programs to document and [[Electronic circuit simulation|simulate electronic circuits]]. The designers of Verilog wanted a language with syntax similar to the [[C (programming language)|C programming language]], which was already widely used in engineering [[software development]]. Like C, Verilog is [[case-sensitive]] and has a basic [[preprocessor]] (though less sophisticated than that of ANSI C/C++). Its [[control flow]] [[Keyword (computer programming)|keywords]] (if/else, for, while, case, etc.) are equivalent, and its [[operator precedence]] is compatible with C. Syntactic differences include: required bit-widths for variable declarations, demarcation of procedural blocks (Verilog uses begin/end instead of curly braces {}), and many other minor differences. Verilog requires that variables be given a definite size. In C these sizes are inferred from the 'type' of the variable (for instance an integer type may be 32 bits). A Verilog design consists of a [[hierarchy of modules]]. Modules encapsulate ''design hierarchy'', and communicate with other modules through a set of declared input, output, and [[bidirectional port]]s. Internally, a module can contain any combination of the following: net/variable declarations (wire, reg, integer, etc.), [[concurrency (computer science)|concurrent]] and sequential [[statement block]]s, and instances of other modules (sub-hierarchies). Sequential statements are placed inside a begin/end block and executed in sequential order within the block. However, the blocks themselves are executed concurrently, making Verilog a [[dataflow language]]. Verilog's concept of 'wire' consists of both signal values (4-state: "1, 0, floating, undefined") and signal strengths (strong, weak, etc.). This system allows abstract modeling of shared signal lines, where multiple sources drive a common net. When a wire has multiple drivers, the wire's (readable) value is resolved by a function of the source drivers and their strengths. A subset of statements in the Verilog language are [[logic synthesis|synthesizable]]. Verilog modules that conform to a synthesizable coding style, known as RTL ([[register-transfer level]]), can be physically realized by synthesis software. Synthesis software algorithmically transforms the (abstract) Verilog source into a [[netlist]], a logically equivalent description consisting only of elementary logic primitives (AND, OR, NOT, flip-flops, etc.) that are available in a specific [[FPGA]] or [[VLSI]] technology. Further manipulations to the netlist ultimately lead to a circuit fabrication blueprint (such as a [[Mask set|photo mask set]] for an [[Application-specific integrated circuit|ASIC]] or a [[bitstream]] file for an [[FPGA]]). ==History== ===Beginning=== Verilog was created by [[Prabhu Goel]], [[Phil Moorby]] and Chi-Lai Huang between late 1983 and early 1984.<ref>{{cite magazine |title=Verilog's inventor nabs EDA's Kaufman award |date= 7 November 2005 |magazine=EE Times |url=http://www.eetimes.com/document.asp?doc_id=1157349}}</ref> Chi-Lai Huang had earlier worked on a hardware description LALSD, a language developed by Professor [[S.Y.H. Su]], for his PhD work.<ref>{{cite book |first1=Chi-Lai |last1=Huang |first2=S.Y.H. |last2=Su |chapter=Approaches for Computer-Aided Logic System Design Using Hardware Description Language |title=Proceedings of International Computer Symposium 1980, Taipei, Taiwan, December 1980 |pages=772–79O |oclc=696254754}}</ref> The rights holder for this process, at the time proprietary, was "Automated Integrated Design Systems" (later renamed to [[Gateway Design Automation]] in 1985). Gateway Design Automation was purchased by [[Cadence Design Systems]] in 1990. Cadence now has full proprietary rights to Gateway's Verilog and the Verilog-XL, the HDL-simulator that would become the de facto standard (of Verilog [[logic simulator]]s) for the next decade. Originally, Verilog was only intended to describe and allow simulation; the automated synthesis of subsets of the language to physically realizable structures (gates etc.) was developed after the language had achieved widespread usage. Verilog is a portmanteau of the words "verification" and "logic".<ref>{{cite web |title=Oral History of Philip Raymond "Phil" Moorby |date=22 April 2013 |publisher=Computer History Museum |url=http://archive.computerhistory.org/resources/access/text/2013/11/102746653-05-01-acc.pdf |pages=23–25}}</ref> ===Verilog-95=== With the increasing success of [[VHDL]] at the time, Cadence decided to make the language available for open [[standardization]]. Cadence transferred Verilog into the public domain under the [http://www.ovi.org/ Open Verilog International] (OVI) (now known as [[Accellera]]) organization. Verilog was later submitted to [[IEEE]] and became IEEE Standard 1364-1995, commonly referred to as Verilog-95. In the same time frame Cadence initiated the creation of [[Verilog-A]] to put standards support behind its analog simulator [[Spectre Circuit Simulator|Spectre]]. Verilog-A was never intended to be a standalone language and is a subset of [[Verilog-AMS]] which encompassed Verilog-95. ===Verilog 2001=== Extensions to Verilog-95 were submitted back to IEEE to cover the deficiencies that users had found in the original Verilog standard. These extensions became [[IEEE]] Standard 1364-2001 known as Verilog-2001. Verilog-2001 is a significant upgrade from Verilog-95. First, it adds explicit support for (2's complement) signed nets and variables. Previously, code authors had to perform signed operations using awkward bit-level manipulations (for example, the carry-out bit of a simple 8-bit addition required an explicit description of the Boolean algebra to determine its correct value). The same function under Verilog-2001 can be more succinctly described by one of the built-in operators: +, -, /, *, >>>. A generate–endgenerate construct (similar to VHDL's generate–endgenerate) allows Verilog-2001 to control instance and statement instantiation through normal decision operators (case–if–else). Using generate–endgenerate, Verilog-2001 can instantiate an array of instances, with control over the connectivity of the individual instances. File I/O has been improved by several new system tasks. And finally, a few syntax additions were introduced to improve code readability (e.g. always @*, named parameter override, C-style function/task/module header declaration). Verilog-2001 is the version of Verilog supported by the majority of commercial [[Electronic design automation|EDA]] software packages. ===Verilog 2005=== Not to be confused with [[SystemVerilog]], ''Verilog 2005'' ([[IEEE]] Standard 1364-2005) consists of minor corrections, spec clarifications, and a few new language features (such as the uwire keyword). A separate part of the Verilog standard, [[Verilog-AMS]], attempts to integrate analog and mixed signal modeling with traditional Verilog. ===SystemVerilog=== {{Main|SystemVerilog}} The advent of [[hardware verification language]]s such as OpenVera, and Verisity's [[e (verification language)|e language]] encouraged the development of [[Superlog HDL|Superlog]] by Co-Design Automation Inc (acquired by [[Synopsys]]). The foundations of Superlog and Vera were donated to [[Accellera]], which later became the IEEE standard P1800-2005: SystemVerilog. SystemVerilog is a [[superset]] of Verilog-2005, with many new features and capabilities to aid design verification and design modeling. As of 2009, the SystemVerilog and Verilog language standards were merged into SystemVerilog 2009 (IEEE Standard 1800-2009). ===Updates since 2009=== The SystemVerilog standard was subsequently updated in 2012,<ref>[https://standards.ieee.org/ieee/1800/4934/ IEEE 1800-2012], [[IEEE]], 2012</ref> 2017,<ref>[https://standards.ieee.org/ieee/1800/6700/ IEEE 1800-2017], [[IEEE]], 2017</ref> and most recently in December 2023.<ref name="IEEE2023">[https://standards.ieee.org/ieee/1800/7743/ IEEE 1800-2023, IEEE Approved Draft Standard for SystemVerilog--Unified Hardware Design, Specification, and Verification Language], [[IEEE]], 2023</ref> ==Example== A simple example of two [[Flip-flop (electronics)|flip-flops]] follows: <syntaxhighlight lang="verilog"> module toplevel(clock,reset); input clock; input reset; reg flop1; reg flop2; always @ (posedge reset or posedge clock) if (reset) begin flop1 <= 0; flop2 <= 1; end else begin flop1 <= flop2; flop2 <= flop1; end endmodule </syntaxhighlight> The <code><=</code> operator in Verilog is another aspect of its being a hardware description language as opposed to a normal procedural language. This is known as a "non-blocking" assignment. Its action does not register until after the always block has executed. This means that the order of the assignments is irrelevant and will produce the same result: flop1 and flop2 will swap values every clock. The other assignment operator <code>=</code> is referred to as a blocking assignment. When <code>=</code> assignment is used, for the purposes of logic, the target variable is updated immediately. In the above example, had the statements used the <code>=</code> blocking operator instead of <code><=</code>, flop1 and flop2 would not have been swapped. Instead, as in traditional programming, the compiler would understand to simply set flop1 equal to flop2 (and subsequently ignore the redundant logic to set flop2 equal to flop1). An example [[counter (digital)|counter]] circuit follows: <syntaxhighlight lang="verilog"> module Div20x (rst, clk, cet, cep, count, tc); // TITLE 'Divide-by-20 Counter with enables' // enable CEP is a clock enable only // enable CET is a clock enable and // enables the TC output // a counter using the Verilog language parameter size = 5; parameter length = 20; input rst; // These inputs/outputs represent input clk; // connections to the module. input cet; input cep; output [size-1:0] count; output tc; reg [size-1:0] count; // Signals assigned // within an always // (or initial)block // must be of type reg wire tc; // Other signals are of type wire // The always statement below is a parallel // execution statement that // executes any time the signals // rst or clk transition from low to high always @ (posedge clk or posedge rst) if (rst) // This causes reset of the cntr count <= {size{1'b0}}; else if (cet && cep) // Enables both true begin if (count == length-1) count <= {size{1'b0}}; else count <= count + 1'b1; end // the value of tc is continuously assigned // the value of the expression assign tc = (cet && (count == length-1)); endmodule </syntaxhighlight> An example of delays: <syntaxhighlight lang="verilog"> ... reg a, b, c, d; wire e; ... always @(b or e) begin a = b & e; b = a | b; #5 c = b; d = #6 c ^ e; end </syntaxhighlight> The '''always''' clause above illustrates the other type of method of use, i.e. it executes whenever any of the entities in the list (the '''b''' or '''e''') changes. When one of these changes, '''a''' is immediately assigned a new value, and due to the blocking assignment, ''b'' is assigned a new value afterward (taking into account the new value of '''a'''). After a delay of 5 time units, '''c''' is assigned the value of '''b''' and the value of '''c ^ e''' is tucked away in an invisible store. Then after 6 more time units, '''d''' is assigned the value that was tucked away. Signals that are driven from within a process (an initial or always block) must be of type '''reg'''. Signals that are driven from outside a process must be of type '''wire'''. The keyword '''reg''' does not necessarily imply a hardware register. ==Definition of constants== The definition of constants in Verilog supports the addition of a width parameter. The basic syntax is: <''Width in bits''>'<''base letter''><''number''> Examples: *12'h123 – Hexadecimal 123 (using 12 bits) *20'd44 – Decimal 44 (using 20 bits – 0 extension is automatic) *4'b1010 – Binary 1010 (using 4 bits) *6'o77 – Octal 77 (using 6 bits) ==Synthesizable constructs== There are several statements in Verilog that have no analog in real hardware, such as the $display command. However, the examples presented here are the classic (and limited) subset of the language that has a direct mapping to real gates. <syntaxhighlight lang="verilog"> // Mux examples — Three ways to do the same thing. // The first example uses continuous assignment wire out; assign out = sel ? a : b; // the second example uses a procedure // to accomplish the same thing. reg out; always @(a or b or sel) begin case(sel) 1'b0: out = b; 1'b1: out = a; endcase end // Finally — you can use if/else in a // procedural structure. reg out; always @(a or b or sel) if (sel) out = a; else out = b; </syntaxhighlight> The next interesting structure is a [[transparent latch]]; it will pass the input to the output when the gate signal is set for "pass-through", and captures the input and stores it upon transition of the gate signal to "hold". The output will remain stable regardless of the input signal while the gate is set to "hold". In the example below the "pass-through" level of the gate would be when the value of the if clause is true, i.e. gate = 1. This is read "if gate is true, the din is fed to latch_out continuously." Once the if clause is false, the last value at latch_out will remain and is independent of the value of din. <syntaxhighlight lang="verilog"> // Transparent latch example reg latch_out; always @(gate or din) if(gate) latch_out = din; // Pass through state // Note that the else isn't required here. The variable // latch_out will follow the value of din while gate is // high. When gate goes low, latch_out will remain constant. </syntaxhighlight> The [[Flip-flop (electronics)|flip-flop]] is the next significant template; in Verilog, the D-flop is the simplest, and it can be modeled as: <syntaxhighlight lang="verilog"> reg q; always @(posedge clk) q <= d; </syntaxhighlight> The significant thing to notice in the example is the use of the non-blocking assignment. A basic [[rule of thumb]] is to use '''<=''' when there is a '''posedge''' or '''negedge''' statement within the always clause. A variant of the D-flop is one with an asynchronous reset; there is a convention that the reset state will be the first if clause within the statement. <syntaxhighlight lang="verilog"> reg q; always @(posedge clk or posedge reset) if(reset) q <= 0; else q <= d; </syntaxhighlight> The next variant is including both an asynchronous reset and asynchronous set condition; again the convention comes into play, i.e. the reset term is followed by the set term. <syntaxhighlight lang="verilog"> reg q; always @(posedge clk or posedge reset or posedge set) if(reset) q <= 0; else if(set) q <= 1; else q <= d; </syntaxhighlight> Note: If this model is used to model a Set/Reset flip flop then simulation errors can result. Consider the following test sequence of events. 1) reset goes high 2) clk goes high 3) set goes high 4) clk goes high again 5) reset goes low followed by 6) set going low. Assume no setup and hold violations. In this example the always @ statement would first execute when the rising edge of reset occurs which would place q to a value of 0. The next time the always block executes would be the rising edge of clk which again would keep q at a value of 0. The always block then executes when set goes high which because reset is high forces q to remain at 0. This condition may or may not be correct depending on the actual flip flop. However, this is not the main problem with this model. Notice that when reset goes low, that set is still high. In a real flip flop this will cause the output to go to a 1. However, in this model it will not occur because the always block is triggered by rising edges of set and reset – not levels. A different approach may be necessary for set/reset flip flops. The final basic variant is one that implements a D-flop with a mux feeding its input. The mux has a d-input and feedback from the flop itself. This allows a gated load function. <syntaxhighlight lang="verilog"> // Basic structure with an EXPLICIT feedback path always @(posedge clk) if(gate) q <= d; else q <= q; // explicit feedback path // The more common structure ASSUMES the feedback is present // This is a safe assumption since this is how the // hardware compiler will interpret it. This structure // looks much like a latch. The differences are the // '''@(posedge clk)''' and the non-blocking '''<=''' // always @(posedge clk) if(gate) q <= d; // the "else" mux is "implied" </syntaxhighlight> Note that there are no "initial" blocks mentioned in this description. There is a split between FPGA and ASIC synthesis tools on this structure. FPGA tools allow initial blocks where reg values are established instead of using a "reset" signal. ASIC synthesis tools don't support such a statement. The reason is that an FPGA's initial state is something that is downloaded into the memory tables of the FPGA. An ASIC is an actual hardware implementation. ==Initial and always== There are two separate ways of declaring a Verilog process. These are the '''always''' and the '''initial''' keywords. The '''always''' keyword indicates a free-running process. The '''initial''' keyword indicates a process executes exactly once. Both constructs begin execution at simulator time 0, and both execute until the end of the block. Once an '''always''' block has reached its end, it is rescheduled (again). It is a common misconception to believe that an initial block will execute before an always block. In fact, it is better to think of the '''initial'''-block as a special-case of the '''always'''-block, one which terminates after it completes for the first time. <syntaxhighlight lang="verilog"> //Examples: initial begin a = 1; // Assign a value to reg a at time 0 #1; // Wait 1 time unit b = a; // Assign the value of reg a to reg b end always @(a or b) // Any time a or b CHANGE, run the process begin if (a) c = b; else d = ~b; end // Done with this block, now return to the top (i.e. the @ event-control) always @(posedge a)// Run whenever reg a has a low to high change a <= b; </syntaxhighlight> These are the classic uses for these two keywords, but there are two significant additional uses. The most common of these is an '''always''' keyword without the '''@(...)''' sensitivity list. It is possible to use always as shown below: <syntaxhighlight lang="verilog"> always begin // Always begins executing at time 0 and NEVER stops clk = 0; // Set clk to 0 #1; // Wait for 1 time unit clk = 1; // Set clk to 1 #1; // Wait 1 time unit end // Keeps executing — so continue back at the top of the begin </syntaxhighlight> The '''always''' keyword acts similar to the C language construct '''while(1) {..}''' in the sense that it will execute forever. The other interesting exception is the use of the '''initial''' keyword with the addition of the '''forever''' keyword. The example below is functionally identical to the '''always''' example above. <syntaxhighlight lang="verilog"> initial forever // Start at time 0 and repeat the begin/end forever begin clk = 0; // Set clk to 0 #1; // Wait for 1 time unit clk = 1; // Set clk to 1 #1; // Wait 1 time unit end </syntaxhighlight> ==Fork/join== The '''fork/join''' pair are used by Verilog to create parallel processes. All statements (or blocks) between a fork/join pair begin execution simultaneously upon execution flow hitting the '''fork'''. Execution continues after the '''join''' upon completion of the longest running statement or block between the '''fork''' and '''join'''. <syntaxhighlight lang="verilog"> initial fork $write("A"); // Print char A $write("B"); // Print char B begin #1; // Wait 1 time unit $write("C"); // Print char C end join </syntaxhighlight> The way the above is written, it is possible to have either the sequences "ABC" or "BAC" print out. The order of simulation between the first $write and the second $write depends on the simulator implementation, and may purposefully be randomized by the simulator. This allows the simulation to contain both accidental race conditions as well as intentional non-deterministic behavior. Notice that VHDL cannot dynamically spawn multiple processes like Verilog.<ref>{{cite web |first=Clifford E. |last=Cummings |title=SystemVerilog – Is This The Merging of Verilog & VHDL? |year=2003 |publisher=SNUG Boston 2003 |url=http://www.sunburst-design.com/papers/CummingsSNUG2003Boston_SystemVerilog_VHDL.pdf }}</ref> ==Race conditions== The order of execution is not always guaranteed within Verilog. This can best be illustrated by a classic example. Consider the code snippet below: <syntaxhighlight lang="verilog"> initial a = 0; initial b = a; initial begin #1; $display("Value a=%d Value of b=%d",a,b); end </syntaxhighlight> Depending on the order of execution of the initial blocks, it could be zero and zero, or alternately zero and some other arbitrary uninitialized value. The <code>$display</code> statement will always execute after both assignment blocks have completed, due to the #1 delay. ==Operators== Note: These operators are ''not'' shown in order of precedence. {| class=wikitable |- ! Operator type || Operator symbols || Operation performed |- | rowspan=5|Bitwise || ~ || Bitwise NOT (1's complement) |- | & || Bitwise AND |- | <nowiki>|</nowiki> || Bitwise OR |- | ^ || Bitwise XOR |- | ~^ or ^~ || Bitwise XNOR |- | rowspan=3|Logical || ! || NOT |- | && || AND |- | <nowiki>||</nowiki> || OR |- | rowspan=6|Reduction || & || Reduction AND |- | ~& || Reduction NAND |- | <nowiki>|</nowiki> || Reduction OR |- | <nowiki>~|</nowiki> || Reduction NOR |- | ^ || Reduction XOR |- | ~^ or ^~ || Reduction XNOR |- | rowspan=6|Arithmetic || + || Addition |- | - || Subtraction |- | - || 2's complement |- | * || Multiplication |- | / || Division |- | ** || Exponentiation (*Verilog-2001) |- | rowspan=8| Relational || > || Greater than |- | < || Less than |- | >= || Greater than or equal to |- | <= || Less than or equal to |- | == || Logical equality (bit-value 1'bX is removed from comparison) |- | != || Logical inequality (bit-value 1'bX is removed from comparison) |- | === || 4-state logical equality (bit-value 1'bX is taken as literal) |- | !== || 4-state logical inequality (bit-value 1'bX is taken as literal) |- | rowspan=4| Shift || >> || [[Logical shift|Logical right shift]] |- | << || [[Logical shift|Logical left shift]] |- | >>> || [[Arithmetic shift|Arithmetic right shift]] (*Verilog-2001) |- | <<< || [[Arithmetic shift|Arithmetic left shift]] (*Verilog-2001) |- | Concatenation || <nowiki>{, }</nowiki> || Concatenation |- | Replication || <nowiki>{n{m}}</nowiki> || Replicate value m for n times |- | Conditional || ? : || Conditional |} ==Four-valued logic== The IEEE 1364 standard defines a [[four-valued logic]] with four states: 0, 1, Z ([[high impedance]]), and X (unknown logic value). For the competing VHDL, a dedicated standard for multi-valued logic exists as [[IEEE 1164]] with nine levels.<ref>{{cite book|first1=D. Michael |last1=Miller|first2=Mitchell A. |last2=Thornton|title=Multiple valued logic: concepts and representations|year=2008|publisher=Morgan & Claypool |isbn=978-1-59829-190-2|series=Synthesis Lectures on Digital Circuits and Systems|volume=12}}</ref> ==System tasks== System tasks are available to handle simple I/O and various design measurement functions during simulation. All system tasks are prefixed with '''$''' to distinguish them from user tasks and functions. This section presents a short list of the most frequently used tasks. It is by no means a comprehensive list. * $display – Print to screen a line followed by an automatic newline. * $write – Print to screen a line without the newline. * $swrite – Print to variable a line without the newline. * $sscanf – Read from variable a format-specified string. (*Verilog-2001) * $fopen – Open a handle to a file (read or write) * $fdisplay – Print a line from a file followed by an automatic newline. * $fwrite – Print to file a line without the newline. * $fscanf – Read from file a format-specified string. (*Verilog-2001) * $fclose – Close and release an open file handle. * $readmemh – Read hex file content into a memory array. * $readmemb – Read binary file content into a memory array. * $monitor – Print out all the listed variables when any change value. * $time – Value of current simulation time. * $dumpfile – Declare the VCD ([[Value change dump|Value Change Dump]]) format output file name. * $dumpvars – Turn on and dump the variables. * $dumpports – Turn on and dump the variables in Extended-VCD format. * $random – Return a random value. ==Program Language Interface (PLI)== The PLI provides a programmer with a mechanism to transfer control from Verilog to a program function written in C language. It is officially [[deprecated]] by IEEE Std 1364-2005 in favor of the newer [[Verilog Procedural Interface]], which completely replaces the PLI. The PLI (now VPI) enables Verilog to cooperate with other programs written in the C language such as [[test harness]]es, [[instruction set simulator]]s of a [[microcontroller]], [[debugger]]s, and so on. For example, it provides the C functions <code>tf_putlongp()</code> <ref>{{cite web| url=https://perso.telecom-paristech.fr/guilley/ENS/20171205/TP/tp_syn/doc/IEEE_verilogHDL_1364-2001.pdf#page=652 |title=IEEE Standard Verilog® Hardware Description Language |page=652(25.38) |accessdate=2023-11-12}}</ref> and <code>tf_getlongp()</code><ref>{{cite web| url=https://perso.telecom-paristech.fr/guilley/ENS/20171205/TP/tp_syn/doc/IEEE_verilogHDL_1364-2001.pdf#page=628 |title=IEEE Standard Verilog® Hardware Description Language |page=628(25.28) |accessdate=2023-11-12}}</ref> which are used to write and read the 64-bit integer argument of the current Verilog task or function, respectively. For 32-bit integers, <code>tf_putp()</code><ref>{{cite web| url=https://perso.telecom-paristech.fr/guilley/ENS/20171205/TP/tp_syn/doc/IEEE_verilogHDL_1364-2001.pdf#page=653 |title=IEEE Standard Verilog® Hardware Description Language |page=653(25.39) |accessdate=2023-11-25}}</ref> and <code>tf_getp()</code><ref>{{cite web| url=https://perso.telecom-paristech.fr/guilley/ENS/20171205/TP/tp_syn/doc/IEEE_verilogHDL_1364-2001.pdf#page=631 |title=IEEE Standard Verilog® Hardware Description Language |page=631(25.21) |accessdate=2023-11-25}}</ref> are used. ==Simulation software== For information on Verilog simulators, see the [[list of Verilog simulators]]. ==See also== ===Additional material=== * [[List of HDL simulators]] * [[Waveform viewer]] * [[SystemVerilog DPI|SystemVerilog Direct Programming Interface (DPI)]] * [[Verilog Procedural Interface]] (VPI) ===Similar languages=== * [[VHDL]], the main competitor to Verilog and SystemVerilog. * [[Verilog-A]] and [[Verilog-AMS]]: Verilog with analog extensions. * [[SystemC]] — C++ library providing [[hardware description language|HDL]] event-driven semantics * [[SystemVerilog]] * [[e (verification language)]] * [[Property Specification Language]] * [[Chisel (programming language)|Chisel]], an open-source language built on top of Scala ==References== {{Reflist}} ;Notes {{Refbegin}} *{{Cite book | doi = 10.1109/IEEESTD.2006.99495| year = 2006| isbn = 0-7381-4850-4| title = IEEE Standard for Verilog Hardware Description Language}} *{{Cite book | doi = 10.1109/IEEESTD.2001.93352| year = 2001| isbn = 0-7381-2826-0| title = IEEE Standard Verilog Hardware Description Language}} *{{Cite book | doi = 10.1109/IEEESTD.2004.95753| year = 2004| isbn = 2-8318-7675-3| title = IEC 61691-4 Ed.1 (IEEE STD 1364(TM)-2001): Behavioural Languages - Part 4: Verilog(C) Hardware Description Language}} *{{Cite book | doi = 10.1109/IEEESTD.1996.81542| year = 1996| isbn = 978-0-7381-3065-1| title = IEEE Standard Hardware Description Language Based on the Verilog(R) Hardware Description Language}} *{{cite book |first1=Donald E. |last1=Thomas |last2=Moorby |first2=Phillip R. |title=The Verilog® Hardware Description Language |publisher=Springer |year=2013 |edition=3rd |isbn=978-1475724646 |url=https://books.google.com/books?id=kGDaBwAAQBAJ&pg=PR2}} * [http://instruct1.cit.cornell.edu/Courses/ece576/Verilog/coding_and_synthesis_with_verilog.pdf Cornell ECE576 Course illustrating synthesis constructs] *{{cite book |first=Janick |last=Bergeron |title=Writing Testbenches: Functional Verification of HDL Models |url=https://books.google.com/books?id=Zi_jBwAAQBAJ&pg=PR1 |year=2012 |publisher=Springer |isbn=978-1-4615-0302-6 |edition=2nd}} (The HDL Testbench Bible) {{Refend}} ==External links== {{Wikibooks|Programmable Logic/Verilog}} ===Standards development=== * {{cite journal|url=https://ieeexplore.ieee.org/document/1620780|doi=10.1109/IEEESTD.2006.99495|isbn=978-0-7381-4851-9|title=IEEE Standard for Verilog Hardware Description Language |journal=IEEE STD 1364-2005 (Revision of IEEE STD 1364-2001) |date=April 2006 |pages=1–590 |url-access=subscription }} – The official standard for Verilog 2005 (not free). * [http://www.verilog.com/IEEEVerilog.html IEEE P1364] – Working group for Verilog (inactive). * [http://www.eda.org/sv-ieee1800/ IEEE P1800] – Working group for SystemVerilog (replaces above). * [http://www.verilog.com/VerilogBNF.html Verilog syntax] – A 1995 description of the syntax in [[Backus-Naur form]]. This predates the IEEE-1364 standard. ===Language extensions=== * [http://www.veripool.org/verilog-mode Verilog AUTOs] — An open-source meta-comment used by industry IP to simplify maintaining Verilog code. {{Programmable Logic}} {{IEEE standards}} {{Authority control}} [[Category:Hardware description languages]] [[Category:IEEE DASC standards]] [[Category:IEC standards]] [[Category:Articles with example code]] [[Category:Structured programming languages]] [[Category:Domain-specific programming languages]] [[Category:Programming languages created in 1984]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite magazine
(
edit
)
Template:Cite web
(
edit
)
Template:IEEE standards
(
edit
)
Template:Infobox programming language
(
edit
)
Template:Main
(
edit
)
Template:Programmable Logic
(
edit
)
Template:Refbegin
(
edit
)
Template:Refend
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use American English
(
edit
)
Template:Use dmy dates
(
edit
)
Template:Wikibooks
(
edit
)