<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://calebneedscollege.com/wiki/index.php?action=history&amp;feed=atom&amp;title=NAND_Gate_%28Verilog%29</id>
	<title>NAND Gate (Verilog) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://calebneedscollege.com/wiki/index.php?action=history&amp;feed=atom&amp;title=NAND_Gate_%28Verilog%29"/>
	<link rel="alternate" type="text/html" href="http://calebneedscollege.com/wiki/index.php?title=NAND_Gate_(Verilog)&amp;action=history"/>
	<updated>2026-04-16T14:24:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.1</generator>
	<entry>
		<id>http://calebneedscollege.com/wiki/index.php?title=NAND_Gate_(Verilog)&amp;diff=328&amp;oldid=prev</id>
		<title>Legg: Created page with &quot;==Synopsis==  All logic gates can be simplified to a NAND Gate.  This is a demonstration of a NAND Gate in Verilog  ==Notes== I am not an expert, but I discourage using truth...&quot;</title>
		<link rel="alternate" type="text/html" href="http://calebneedscollege.com/wiki/index.php?title=NAND_Gate_(Verilog)&amp;diff=328&amp;oldid=prev"/>
		<updated>2023-09-12T18:51:27Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Synopsis==  All logic gates can be simplified to a NAND Gate.  This is a demonstration of a NAND Gate in Verilog  ==Notes== I am not an expert, but I discourage using truth...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
All logic gates can be simplified to a NAND Gate.  This is a demonstration of a NAND Gate in Verilog&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
I am not an expert, but I discourage using truth tables in Verilog as doing so may defeat optimizations that the compiler may otherwise perform.  This is only included as a reference, not as a best practice.&lt;br /&gt;
&lt;br /&gt;
==Compilation==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
iverilog -o Nand_tb.vvp Nand_tb.v&lt;br /&gt;
vvp Nand_tb.vvp&lt;br /&gt;
gtkwave Nand_tb.vcd&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Code Nand.v by assignment==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Verilog&amp;quot; line='line'&amp;gt;&lt;br /&gt;
module Nand(Q,A,B);&lt;br /&gt;
	output Q;&lt;br /&gt;
	input A,B;&lt;br /&gt;
	assign Q = ~(A &amp;amp; B);&lt;br /&gt;
	endmodule&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Code Nand.v by truth table==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Verilog&amp;quot; line='line'&amp;gt;&lt;br /&gt;
primitive Nand(Q, A, B);&lt;br /&gt;
	output Q;&lt;br /&gt;
	input A,B;&lt;br /&gt;
	table&lt;br /&gt;
		0 0 : 1;&lt;br /&gt;
		0 1 : 1;&lt;br /&gt;
		1 0 : 1;&lt;br /&gt;
		1 1 : 0;&lt;br /&gt;
		x ? : 0;&lt;br /&gt;
		? x : 0;&lt;br /&gt;
	endtable&lt;br /&gt;
endprimitive&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Code Nand_tb.v test bench==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Verilog&amp;quot; line='line'&amp;gt;&lt;br /&gt;
`timescale 1ns/1ns&lt;br /&gt;
`include &amp;quot;Nand.v&amp;quot;&lt;br /&gt;
&lt;br /&gt;
module Nand_tb;&lt;br /&gt;
&lt;br /&gt;
reg A;&lt;br /&gt;
reg B;&lt;br /&gt;
wire Q;&lt;br /&gt;
&lt;br /&gt;
Nand uut(Q,A,B);&lt;br /&gt;
&lt;br /&gt;
initial begin&lt;br /&gt;
	$dumpfile(&amp;quot;Nand_tb.vcd&amp;quot;);&lt;br /&gt;
	$dumpvars(0,Nand_tb);&lt;br /&gt;
&lt;br /&gt;
A = 0;&lt;br /&gt;
B = 0;&lt;br /&gt;
#10;&lt;br /&gt;
A = 1;&lt;br /&gt;
#10;&lt;br /&gt;
B = 1;&lt;br /&gt;
#10;&lt;br /&gt;
A = 0;&lt;br /&gt;
#10;&lt;br /&gt;
&lt;br /&gt;
$display(&amp;quot;Test Complete!&amp;quot;);&lt;br /&gt;
end&lt;br /&gt;
endmodule&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==Pictures==&lt;br /&gt;
[[&lt;br /&gt;
[[File:GTKWave NAND.png|thumb|GTKWave Signals of a NOR Gate]]&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Legg</name></author>
		
	</entry>
</feed>