(file) Return to VerilogHW1.doc CVS log (file) (dir) Up to [RizwankCVS] / geekymedia_web / phpBB2 / attach

  1 rizwank 1.1 ࡱ>	!# U@	bjbj	".TTTThLN,,,AAAA;BGM$ORQ\M,*N,,,MM}3}3}3,A}3,A}3}34s@hA oT.AAM0N-A^MR2MR,AMRA$,,}3,,,,,MMDTm3TECE 415								Dr. H. El Naga

Verilog: Modeling, Simulation and Synthesis
Homework  #1


1. a.	Write a Verilog structural model for 3x8 binary decoder. Use the following module header:

	module ThreexEight ( .    );
	output .;
input..;
	  o o o

	endmodule


Write a well documented  exhaustive testbench to test the 3x8 binary decoder of part a. 


module ThreexEight(f, i, enable);
output [7:0] f;
input [2:0] i;
input enable;






Generate the displayed output, in the right order, for the following Verilog code. Indicate which system task is responsible for what output.

module display_example;
   reg [15:0] data1, data2;
   reg index;

initial
  begin
    $writeo (%d , $time, , %h  \t, data1, , %h  \t, data1, , index, \n);
    #31 data1=15 ; data2 = 10; index = 1;
    $displayh ($time, , data1, , data2, , index);
  end

initial
  begin
     #5  data2 = 31 ; index = 0;
     $strobe ($time , ,  data2 , , index);
     $display ($time , , data2 , , index);
     data2 = 15;
end
endmodule














Complete the following table for the above circuit:










4. a.	Write a structural model of a 4-input multiplexer by instantiating the 2-input mux of Lab #1: MUX2_1(out, a, b, sel).  Use the following module header:

	module MUX4_1(out, In, sel);
	output out;
input [3:0] In ;
input [1:0] sel;
	  o o o

	endmodule

Write a well documented exhaustive testbench to test the 4-input multiplexer of part a. Use hierarchical referencing to monitor every intermediate signal along the path from In[0] to the output.

5. a.	Using nand and xor Verilog primitives only, construct a full-adder module assuming the following:
nand gates  have a time delay of 10 ns each, and
		xor gates have a time delay of 15 ns each.
	
Use the following module header:

	module Full_adder ( cout, Sum, X, Y, cin);
		output  cout;
		output  Sum;
input   X, Y ;
input  cin;
	  	o o o

	endmodule

   b.	Write a structural model of a 4-bit adder by instantiating the full adder module of part a (use an array of instances if possible).  Use the following module header:

	module Adder_4( cout, Sum, X, Y, cin);
		output cout;
		output [3:0] Sum;
input [3:0] X, Y ;
input cin;
	  	o o o

	endmodule

Write a testbench to test the 4-bit adder of part b. Use hierarchical referencing to monitor every intermediate signal along the path from X[2] to the output Sum[3].

6.	Are each of the following legal Verilog statement? If not, identify the error and suggest a correction for it. 

a.  'timescale 1ns/1ns

b.  `timescale 50 ns / 10 ns;

c.  `timescale 100 ms /1 ns

d.  `timescale 1ns

e.  `timescale 1ns/100ps
   	 module One (...);
   	    o o o
 	  endmodule

  	 `timescale 10ns/1ns
   	 module Two (...);
  	     o o o
 	  endmodule

 ` timescale 100fs/1ns


g.  ` t i m e s c a l e   1 0 0 n s / 1 0 n s

h.  `timecsale 10ns/1ns

i.  `timescale        100        ns        /        10        ns

j. `timescale 100ms/10ms

k. `timescale 100s/10s

l. `timescale 10ns/1ns
     o o o
     nand #10.0625 (...);




f
f
f
f
f
f
f
f

0
1
2
3
4
5
6
7


3 x 8

I0

I1

I2

E/D

X    Y   C1   C2     out

x    x     0      0
x    1     0      1    
0    x     1      0 
x    0     0      x
1    x     x      0
0    1     x      x



out

X

C1

Y

C2



 EMBED SmartDraw.2  



XZ[		b	c		G
  2             H
  3             
  4             BCDEM
N
"'*z~GV
࣬
  5             h*CJ
  6             h*CJH
  7             h*CJh*mHsHh*6OJQJh*OJQJ	h*<!jh*5CJUmHnHuh*6B*hph
h*6CJhk@
  8             h*CJjh*CJUmHnHuh*	h*56KXYZ				b	c	d		
  9             &dP
 10             &F
^	^`	^`	^`^^	0^`0$a$										G
 11             H
 12             `
 13             |
 14             
 15             
 16             
 17             
 18             
 19             HNOW_^^
 20             &Fh`hgdk@	
 21             ABDEFGHI$a$
 22 rizwank 1.1 &F^^IJKL	

'
8
A
B
M
N
z$Z^Za$$	^	`a$$	V^	`Va$	0^`0	
 23             &F
	^`	^`^^(8GVblmxy%&N]q	>^`>`	^`	T^T`^^	^`LM()BYguv
 24             &F
h0`0	^`
 25             &F	^`	
 26             "#de~$a$	
+,@Xm
*+
 27             h*CJHjUC{=
 28             h*UVjh*U
 29             h*CJ	h*<h*5OJPJQJ	h*5h*
 30             h*CJ$a$ P/ =!"#$%>Dd
 31             	zz<
 32             
 33             CA2fim_pFD`!fim_pFX~xYSPxڵN0㴴"0TBb@H,ЍJ#0dAyVe@i"XJ?w?C؃!egc]]ŀi_2<ωmv"i5ESw.G&RqyEPV~yEr1.Bޥ
 34             ھw P9/hЭՏՀf7RAMN<M1Mnif>PrZYgf=3DnfꎖFnZ!Aq͞⚷=&%ϔtpqI慻P5J&jfXݔt}ܢ4)L҈(ԝB7
y
Gi{g}	
 35             
"%&Y'()*+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXRoot Entry
 36             	F@(o$@Data
 37             WordDocument	".ObjectPool}o@(o_1031488341 i0DEST}o}oOle
 38             CompObj\ObjInfo	
 39             
 !"#$%&'()*+,-./0123456789:;<=>@ABCDEGHIJL
 40              i0DESTSmartDraw.2SmartDraw.2SmartDraw.29qSMARTDRWdX$0u0udd'Brother MFL Pro Printer,brmfl96a,LPT1:dBrother MFL Pro Printer#XCONTENTS1Table/yRSummaryInformation(?DocumentSummaryInformation8F XSBrother MFL Pro Printer0QeVMS Sans SerifdN"VTimes New RomandN@
 41             @ 0u0u*Black & WhiteN
 42             Times New RomanTimes New Roman5Y@?),
 43 rizwank 1.1 "HL
..@XXHH%&H. "@"Ht~gsIsI,,
(
 44             ::$#&H[1G0``@I	e.Ye0``@45-	"-'-	"-$YY''"@"HL..@XXHH%&H. "@"HtpYs;s;,,
(
 45             ::$#&H[#G0``@I	e.Ye0``@45-	"-'-	"-$YY''"@"HI(4(4...(
 46             0u0u%&H(4 "@"Hx.Z.Z,.Z(
 47             L;L;%&H.Z "@ @@Oh+'0t	
 48             $0<
HT\dlEE629CE62CompaqompNormal.dotRizwan Kassimo3zwMicrosoft Word 10.0@J6@M|$@z@a
 49             ՜.+,0hp|
 C{
 50             EE629CTitle
 51             	FMicrosoft Word Document
 52             MSWordDocWord.Document.89qD@DNormalCJOJQJ_HmH	sH	tH	DADDefault Paragraph FontVi@VTable Normal :V44
 53             la(k@(No ListXC@XBody Text Indenth^h`CJOJQJPR@PBody Text Indent 2h^h`PS@PBody Text Indent 3^`RY"RDocument Map-D M
 54             OJQJ^J#*6;>=<7#*6;.KXYZ	bcdGH`|HNOW_	
 55             ABDEFGHIJKL	'8ABMNz(8GVblmxy%&N]qL	M							
 56             
 57             (
 58             )
 59             B
 60             Y
 61             g
 62             u
 63             v
 64 rizwank 1.1 
 65             
 66             
 67             
 68             
 69             
 70             
 71             
 72             	
 73             "#de~	
+,@Xm0000000000000000 000000000x0000x 00000000000000000000000000000000000 000000000000000000000 0000000000000000000000000000 0000000000000000000000 0000000000000000000000000000
;0f000000000
;0d0
;0d00000
;0f0
;0f% 
;0
;0
;0
;0
;0
;0
;0
;0
;0
;0f% 
;0f% 
;0
;0
;0
;0
;0
;0
;0
;0
;0d% 
;0
;0
	I
:8@A@@H(	
 74             dZ	h>
)
 75             3"T
 76             
 77             #5%>
'y
4
 78             
 79             #&cL	o')
 80             o')T
 81             
 82             #'-)
Z
 83             
 84             3o'('
ZB
 85 rizwank 1.1 
 86             SD&'ZB
 87             
 88             SD&Y'YZB
 89             
 90             SD&'ZB
 91             	
 92             SD&'ZB
 93             
 94             
 95             SD&u'uZB
 96             
 97             SD')')ZB
 98             
 99             SD&
100             '
101             ZB
102             

103             SD''T
104             
105             #'$:&
ZB
106 rizwank 1.1 
107             SD ,#,T
108             
109             #hZ*!
ZB
110             
111             SD5%
5%ZB
112             
113             SD $#$ZB
114             
115             SD #\
116             7
117             3	7"
	VB
118             8
119             CD"VB
120             9
121             CD"VB
122             :@
123             CD"VB
124             ;@
125             CD"V
126             <
127 rizwank 1.1 #"
V
128             =
129             #"
P
130             >
131             "	
VB
132             ?
133             CD"
134             VB
135             @
136             CD"B
137             S	?Z
138             B`4"	t7
t<b
t8n!t=t:yt9Pt;[t@	t>	t?t-6kvz{O^cf#36=>?@CLqz"'*z~"%26]`hijknw7;HKW[c
139             d
140             e
141             f
142             k
143             t
144             
145             
146             
147             
148 rizwank 1.1 
149             
150             
151             
152             
153             
154             12>?xyKV,djHNcf*-JMOVY^em
155             ',;<CLz~*6:EGUV`fgnw'-PV_eqv1	3	M	S							
156             
157             )
158             .
159             G
160             M
161             a
162             b
163             k
164             t
165             {
166             
167             
168             
169 rizwank 1.1 
170             
171             
172             
173             
174             
175             
176             #(,-@Amn3333333333333333333333333333333333333333333333333333333333333333333333333333333333XXcHIN	Nagi El Naganagi elnaganagi elnaganagi elnagaNagi El NagaNagi El NagaNagi El NagaNagi El Naga
Administrator
Rizwan Kassim5U&@7*	HT?mj@_E	FEJrkjO!mkx:^`o(.^`.pLp^p`L.@@^@`.^`.L^`L.^`.^`.PLP^P`L.hh^h`o(.vv^v`o(.FF^F`.L^`L.
177             
178             ^
179             `.

^
`.L^`L.VV^V`.&&^&`.L^`L.^`o(.^`.pLp^p`L.@@^@`.^`.L^`L.^`.^`.PLP^P`L.hh^h`o(.hh^h`o(.^`.pLp^p`L.@@^@`.^`.L^`L.^`.^`.PLP^P`L. ^` o(.^`o(.^`.pLp^p`L.@@^@`.^`.L^`L.^`.^`.PLP^P`L._E*F!mkmj@Jrk5U&HT?k@b1*@Acrobat DistillerNe00:winspoolAdobePS Acrobat DistillerAcrobat DistillerLetterPRIV0''''(\KhC(EBDAeBookAcrobat DistillerLetterPRIV0''''(\KhC(EBDAeBooko`@UnknownGz Times New Roman5Symbol3&z ArialIArial Unicode MSY	New YorkTimes New Roman5&zaTahoma"AttyI
180             
181             !;23Q;H(?b1EE629CCompaq
Rizwan Kassim,CompObjKj

Rizwan Kassim
Powered by
ViewCVS 0.9.2