Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
xst.pdf
Скачиваний:
141
Добавлен:
11.06.2015
Размер:
5.64 Mб
Скачать

R

Verilog Parameters

input C; input CLR; input D; endmodule

(* BOX_TYPE="PRIMITIVE" *) // Verilog-2001 module BUFG ( O, I);

output O; input I; endmodule

Verilog Parameters

Verilog modules allow you to define constants known as parameters. Parameters can be passed to module instances to define circuits of arbitrary widths. Parameters form the basis of creating and using parameterized blocks in a design to achieve hierarchy and stimulate modular design techniques.

Verilog Parameters Coding Example

The following Verilog coding example shows the use of parameters. Null string parameters are not supported:

module lpm_reg (out, in, en, reset, clk); parameter SIZE = 1;

input in, en, reset, clk; output out;

wire

[SIZE-1

: 0] in;

 

reg

[SIZE-1

: 0] out;

always

@(posedge clk or negedge reset)

begin

 

 

if

(!reset)

 

 

 

out <= 1’b0;

 

else

 

 

 

if (en)

 

 

 

out <=

in;

 

 

else

 

 

 

out <=

out;

//redundant assignment

end

 

 

 

endmodule

 

 

module

top ();

//portlist left blank intentionally

...

 

 

 

wire

[7:0] sys_in, sys_out;

wire

sys_en,

sys_reset, sysclk;

lpm_reg #8 buf_373 (sys_out, sys_in, sys_en, sys_reset, sysclk);

...

endmodule

Instantiation of the module lpm_reg with a instantiation width of 8 causes the instance buf_373 to be 8 bits wide.

The “Generics (-generics)” command line option allows you to redefine parameters (Verilog) values defined in the top-level design block. This allows you to easily modify the design configuration without any Hardware Description Language (HDL) source modifications, such as for IP core generation and testing flows.

XST User Guide

www.xilinx.com

505

10.1

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]