Главная » Просмотр файлов » Donald E. Thomas - The Verilog Hardware Description Language, Fifth Edition

Donald E. Thomas - The Verilog Hardware Description Language, Fifth Edition (798541), страница 30

Файл №798541 Donald E. Thomas - The Verilog Hardware Description Language, Fifth Edition (Donald E. Thomas - The Verilog Hardware Description Language, Fifth Edition) 30 страницаDonald E. Thomas - The Verilog Hardware Description Language, Fifth Edition (798541) страница 302019-09-20СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 30)

An output port specifies the internal name for a vector or scalar whichis driven by an internal entity and is available external to the module. An inout port144The Verilog Hardware Description Languagespecifies the internal name for a vector or scalar that can be driven either by an internal or external entity.It is useful to recap some of the do’s and don’t’s in their specification.

First, an inputor inout port cannot be declared to be of type register. Either of these port types maybe read into a register using a procedural assignment statement, used on the righthand side of a continuous assignment, or used as input to instantiated modules orgates. An inout port may only be driven through a gate with high impedance capabilities such as a bufif0 gate.Secondly, each port connection is a conmodule binaryToESegtinuous assignment of source to sink where(input A, B, C, D,one connected item is the signal source andoutput eSeg);the other is a signal sink.

The output portsof a module are implicitly connected to signand #1nal source entities such as nets, registers,g1 (p1, C, ~D),gate outputs, instantiated module outputs,g2 (p2, A, B),and the left-hand side of continuousg3 (p3, ~B, ~D),assignments internal to the module. Inputg4 (p4, A, C),ports are connected to gate inputs, instantig5 (eSeg, p1, p2, p3, p4);ated module inputs, and the right-handendmoduleside of continuous and procedural assignments.

Inout ports of a module are connected internally to gate outputs or inputs. Externally, only nets may be connected toa module’s outputs.Finally, a module’s ports are normally connected at the instantiation site in theorder in which they are defined. However, we may connect to a module’s ports bynaming the port and giving its connection. Given the definition of binaryToESeg,reprinted here from Example 1.3, we can instantiate it into another module and connect its ports by name as shown below. Example 1.11 instantiated this module usingthe statement:binaryToESeg disp m1 (eSeg, w3, w2, w1, w0);where eSeg, w3, w2, w1, and w0 were all declared as wires.

(The module instancename m1 has been added here to help the discussion.) Alternately, the ports couldhave been specified by listing their connections as shown below:binaryToESeg disp m1 (.eSeg(eSeg), .A(w3), .B(w2), .C(w1), .D(w0));In this statement, we have specified that port eSeg of instance m1 of module binaryToESeg will be connected to wire eSeg, port A to wire w3, port B to wire w2, port Cto wire w1, and port D to wire w0. The period (“.”) introduces the port name asdefined in the module being instantiated. Given that both names are specifiedtogether, the connections may be listed in any order. If a port is to be left uncon-Module Hierarchy145nected, no value is specified in the parentheses — thus .D() would indicate that noconnection is to be made to port D of instance m1 of module binaryToESeg.At this point we can formally specify the syntax needed to instantiate modules andconnect their ports.

Note that the following syntax specification includes both meansof listing the module connections: ordered-port and named-port specifications.module instantiationmodule _identifier [ parameter_value_assignment ] module_instance {,module_instance };parameter_value_assignment# (expression {, expression } )module_instancename_of_instance ([list_of_module_connections])name_of_instancemodule_instance_identifier [ range ]list_of_module_connectionsordered_port_connection {, ordered_port_connection }named_port_connection {, named_port_connection }ordered_port_connection[ expression ]named_port_connectionport_identifier ([ expression ])146The Verilog Hardware Description Language5.2 ParametersParameters allow us to enter definenames for values and expressions thatwill be used in a module’s description.

Some, for instance alocalparam, allow for the specification of a constant, possibly through acompile-time expression. Others(parameter) allow us to define ageneric module that can be parameterized for use in different situations.Not only does this allow us to reusethe same module definition in moresituations, but it allows us to definegeneric information about the module that can be overridden when themodule is instantiated.module xor8(output [1:8]input [1:8]xorxout,xin1, xin2);(xout[8], xinl [8], xin2[8]),(xout[7], xinl [7], xin2[7]),(xout[6], xinl [6], xin2[6]),(xout[5], xinl [5], xin2[5]),(xout[4], xinl [4], xin2[4]),(xout[3], xinl [3], xin2[3]),(xout[2], xinl [2], xin2[2]),(xout[l], xinl [l], xin2[l]);endmoduleExample 5.1 An 8-Bit Exclusive OrExample 5.1 presents an 8-bit XOR module that instantiates eight XOR primitivesand wires them to the external ports.

The ports are 8-bit scalars; bit-selects are used toconnect each primitive. In this section we develop a parameterized version of thismodule.First, we replace the eight XOR gateinstantiations with a single assignstatement as shown in Example 5.2,making this module more generallyuseful with the parameter specification.Here we specify two parameters, thewidth of the module (4) and its delay(10).

Parameter specification is part ofmodule definition as seen in the following syntax specification:module xorx# (parameter width = 4,delay = 10)(output [l:width] xout,input [1:width] xinl, xin2);assign #(delay) xout = xin1 ^ xin2;endmoduleExample 5.2 A Parameterized Modulemodule_declarationmodule_keyword module_identifier [ module_parameter_port_list][list_of_ports];{ module_item }endmodule| module_keyword module_identifier [ module_parameter_port_list][list_of_ports_declarations];{ non_port_module_item }endmoduleModule Hierarchy147module_parameter_port_list# (parameter_declaration { , parameter_declaration})parameter_declarationparameter [ signed ] [ range ] list_of_param_assignments;parameter integer list_of_param_assignments;parameter real list_of_param_assignments;parameter realtime list_of_param_assignments;parameter time list_of_param_assignments;The module_parameter_port_list can be specified right after the module keywordand name; the types of parameters that can be specified include signed, sized (with arange) parameters, as well as parameter types integer, real, realtime, and time.Local parameters have a similar declaration style except that the localparam keyword is used instead of parameter.local_parameter_declarationlocalparam [ signed ] [ range ] list_of_param_assignments;localparam integer list_of_param_assignments;localparam real list_of_param_assignments;localparam realtime list_of_param_assignments;localparam time list_of_param_assignments;These cannot be directly overridden and thus are typically used for defining constantswithin a module.

However, since a local parameter assignment expression can containa parameter (which can be overridden), it can be indirectly overridden.When module xorx is instantiated,module overriddenParametersthe values specified in the parameter(output [3:0] a1, a2);declaration are used. This is a genericinstantiation of the module. However,reg[3:0]b1, c1, b2, c2;an instantiation of this module mayoverride these parameters as illustratedxorx#(4, 0) a(a1, b1, c1),in Example 5.3. The “#(4, 0)” specifiesb(a2, b2, c2);that the value of the first parameterendmodule(width) is 8 for this instantiation, andthe value of the second (delay) is 0.

If theExample 5.3 Overriding GenericParameters“#(4, 0)” was omitted, then the valuesspecified in the module definition wouldbe used instead. That is, we are able to override the parameter values on a per-module-instance basis.The order of the overriding values follows the order of the parameter specificationin the module’s definition.

However, the parameters can also be explicitly overriddenby naming the parameter at the instantiation site. Thus:The Verilog Hardware Description Language148xorx#(.width(4), .delay(0)a(a1, b1, c1),b(a2, b2, c2);would have result as the instantiation of xorx in Example 5.3. With the explicitapproach, the parameters can be listed in any order.

Характеристики

Тип файла
PDF-файл
Размер
7,95 Mb
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6508
Авторов
на СтудИзбе
302
Средний доход
с одного платного файла
Обучение Подробнее