Unit4-DirectivesFuncsTasks-Nazarian-EE577B-Fall10

Unit4-DirectivesFuncsTasks-Nazarian-EE577B-Fall10 -...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
University of Southern California Viterbi School of Engineering EE577B LSI System Design VLSI System Design ompiler Directives Compiler Directives More on Tasks and Functions References: Main and recommended textbooks, and online resources Shahin Nazarian Fall 2010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Compiler Directives Compiler directives are certain identifiers that start with backquote (‘) character A compiler directive can span multiple files and when compiled remains in effect through the entire compilation process until a different compiler directive specifies otherwise. Here is the list of directives: ‘define, ‘undef ‘ifdef, ‘ifndef, ‘else, ‘elsif, ‘endif ‘default_nettype, ‘include, ‘resetall, ‘timescale ‘unconnected_drive, ‘nounconnected_drive Shahin Nazarian/EE577B/Fall 2010 ‘celldefine, ‘endcelldefine, ‘line 2
Background image of page 2
‘define and ‘undef ‘define is very similar to #define in C. It defines a text macro: ‘define MAX_BUS 32 ‘define RES (AW * BW) reg [MAX_BUS-1:0] reg1; Once compiled the definition stays in effect, however if ‘undef is used the definition of the previously defined text acro is removed It’s useful to resolve conflicts between macro is removed. It s useful to resolve conflicts between different files that use the same name for a macro . Shahin Nazarian/EE577B/Fall 2010 …. ‘undef RES // the definition of RES is no longer available 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
‘ifdef, ‘ifndef, ‘else, ‘elseif and ‘endif Two forms: ‘ifdef and ‘ifndef ‘ifdef form checks for the existence of the definition of the macro, whereas ifndef form checks for the lack of definition of the macro Example: ‘ifdef WINDOWS parameter WORD_SIZE = 16; ‘ lse else parameter WORD_SIZE = 32 ‘ ndif Shahin Nazarian/EE577B/Fall 2010 endif 4
Background image of page 4
‘ifdef, ‘ifndef, ‘else, ‘elseif and ‘endif (Cont.) ‘ifndef is the opposite of ‘ifdef, i.e., does something if the macro is not defined Example: ‘ifndef SYNTHESIS ssign #(PERIOD/2) lk ~ lk assign #(PERIOD/2) clk = ~ clk ‘endif Shahin Nazarian/EE577B/Fall 2010 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
‘default_nettype Specifies the default net type, so it is used as the type for nets which are not explicitly declared Example: To specify the default net type as wor ‘default_nettype wor Note: If no implicit type are allowed, ‘ efault nettype one hould be used default_nettype none should be used Shahin Nazarian/EE577B/Fall 2010 6
Background image of page 6
‘include, ‘resetall, ‘timescale ‘include can be used to include the content of any file, by specifying either the relative path or the full path name .include “. ./. ./mygates.v /*upon compilation the line will be replaced with the content of the file “../. ./mygates.v */ ‘resetall resets all compiler directives to their default alue For example it cause the default net type to be value. For example it cause the default net type to be wire Shahin Nazarian/EE577B/Fall 2010 ‘timescale was discussed before 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
‘unconnected_drive, ‘nounconnected_drive Any unconnected input ports in the module instantiations that appear between these two directives
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 35

Unit4-DirectivesFuncsTasks-Nazarian-EE577B-Fall10 -...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online