Microsoft Word - Digital Logic Design v_4_6a

(lily) #1

 Number Representation
Number may be represented in decimal form with or without sign (+12 or -24). Additionally, Verilog
allows for a more precise description by using the following format for defining a number:


<sign><size><base><number> where
<sign> can be ‘+’ or ‘-‘; if not specified, it is positive
<size> is the number of bits (in decimal)
<base> is the number base which is a letter
‘b’ is binary
‘o’ is Octal
‘d’ is decimal
‘h’ is hexadecimal
<number> is the number using digits available in specified base)

Below are a few examples of specifying numbers:

 294 // default type is decimal
 ‘h2FA // hex number but size is not specified
 5’b11 // 5 bit binary number ‘00011’
 +4’b1011 // 4 bit positive binary number ‘1011’
 -3’b101 // 3 bit negative binary number ‘101’
 5’b1110x // 5 bit positive binary number with do not care least significant bit
 ́hff // default 16 bit number ‘00ff’ hex
 16 ́hff // explicitly defined 16 bit number ‘00ff’ hex
 1 ́b1 // 1 binary
 1 ́b0 // 0 binary
 1 ́bx // x binary or one unknown bit
 1 ́bz // one hi-z bit
 32 ́H0ZX1FABX // hexadecimal 32 bits representing binary
// ‘0000 zzzz xxxx 0001 1111 1010 1011 xxxx’
 8 ́b0110_1100 // 8-bit binary 01101100
 4 ́b1x0z // four bits ‘1X0Z’
 18 ́o7573 // 18 bits octol or ‘000 000 111 101 111 011’ binary
 7 ́d 126 // 7 bits decimal 123 or ‘01111010’

 String Representation
A string is a sequence of character enclosed in double quotes. for examples “This is an Example”.


 Logic Values
Verilog utilizes four logic values:


 ‘0’ // false, low, zero
 ‘1’ // true, high, one
 ‘z’ or ‘Z’ // High Impendance or floating for use with tri-state devices
 ‘x’ or ‘X’ // Uninitialized or unknown value

Verilog also allow for logic strength definition which is useful for situations where multiple devices are
driving the same wire in determining the logic present on the wire.

 Module Definition
As discussed earlier module is the basic block of Verilog and is similar in nature to function in C with
added attributes for describing circuit design.


module yourModuleName(inPort1,...,outPortb1,...); // start of module with input and output
// identifiers
Free download pdf