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

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

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

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

This is a fundamental characteristic of asequential circuit, not a combinational one. A synthesized version of such a circuitwill have latches to implement the sequential nature of the description. That’s notcool, given that we’re trying to design a combinational circuit!Another way to view this requirement is for a combinational circuit to be synthesized, the loop in the description must be stateless — nothing can be rememberedfrom its previous execution.Following these two rules will help you in writing behavioral descriptions of combinational circuits that can be used equivalently for either simulation or synthesis.References: synthesis 2Tutorial: See the Tutorial Problems in Appendix A.3.1.3 Procedural Modeling of Clocked SequentialCircuitsProcedural models also can be used to describe finite state machines.

Figure 1.4 showsthe state transition diagram for a machine with three states, one input, and one output. The states are encoded by two ftip ftops namedandThe reset state isencoded with both ftip ftops being zero. Also shown in the figure is an implementation of the machine using D ftip ftops and gates.The traditional diagram of a finite state machine is shown in Figure 1.5. The diagramshows the state registers at the bottom. Their output is the current state of themachine. Their input is the next state of the machine which the registers will loadafter the clock edge. The next state is a combinational function of the current stateand the inputs.

The outputs are a combinational function of the current state and (insome systems) the inputs. This traditional structuring appears in the Verilog description. The next state and output combinational functions will be described behaviorallyin a single always block following the rules of the previous section. The state registerswill be described in a separate always block following a different set of rules.Verilog — A Tutorial Introduction151.3.1 Modeling Finite State MachinesA behavioral description of the machine in Figure 1.4 is shown in Example 1.6. Wehave named the output out, the input in, and have also provided ports for clock andreset.

Further, output out has also been declared to be a register. The current state ofthe machine has been named currentState. The definitionreg[1:0]currentState, nextState;indicates that currentState and nextState are two-bit vectors. The square brackets(“[ ]”) construct declares the range of bit numbers that each register has, the firstnumber being the most-significant bit and the second being the least-significant bit.out is also declared to be a register. It and nextState are assigned to in the combinational always block that implements the next state and output functions.

We haveintroduced the term vector in describing the registers nextState and currentState inthis example. Registers, such as out, and nets which are single-bit are said to be scalar.The Verilog Hardware Description Language16module fsm(output reg out,inputin, clock, reset);reg[1:0] currentState, nextState;always @(in, currentState) begin // the combinational portionout = ~currentState[1] & currentState[0];nextState = 0;if (currentState = = 0)if (in) nextState = 1;if (currentState = = 1)if (in) nextState = 3;if (currentState = = 3) beginif (in) nextState = 3;else nextState = 1;endendalways @(posedge clock, negedge reset) begin // the sequential portionif (~reset)currentState <= 0;elsecurrentState <= nextState;endendmoduleExample 1.6 A Synthesizable Finite State MachineThe first always block describes the combinational behavior of the output and nextstate logic.

The sensitivity list indicates that when a change occurs to in or currentState, then the begin…end statement is executed. The statements in the begin … endspecify the new values of the combinational outputs nextState and out. out is specified asout = ~currentState[1] & currentState[0];indicating that the complement (“~”) of bit 1 of currentState is AND-ed with bit 0 ofcurrentState.

The construct “currentState[1]” is called a bit-select of a vector — only asingle bit from the entire vector is used in this operation. nextState is calculated in thefollowing if statements. Consider the third one.Verilog — A Tutorial Introduction17if (currentState = = 3) beginif (in)nextState = 3;else nextState = 1;endThis states that if currentState is equal to 3 (i.e., 11 in two-bit binary, which corresponds to the bottom-left state in the state transition diagram of Figure 1.4), then thenew value of nextState depends on the value of in.

If in is TRUE, nextState is 3 (i.e.,11 in two-bit binary). Otherwise nextState is 01 in two-bit binary. The rest of thealways statement specifies how nextState is calculated when in other states.The first always block specifies a combinational circuit and it is useful to recheckthe combinational rules presented in section 1.2.2.

First, the only inputs to this combinational function are in and currentState. This can be checked by looking at theright-hand sides of the assignment statements and the conditional expressions in thealways block. No other named entities appear so these must be the inputs. To be combinational, the comma-separated event list must include in and currentState. It does.Secondly, the combinational outputs out and nextState must be declared as registersand assigned to in any execution of the always block. They are assigned to in the firsttwo statements of the always block, whether they are overwritten later or not.The second always block specifies the sequential portion of the finite statemachine. We have seen the procedural assignment “=” as it has been used in initialand always statements.

This always block introduces the non-blocking assignment “ <=”— an assignment that might best be described as a concurrent assignment — used ininitial and always statements with edge specifications (i.e., posedge or negedge). Fornow, just think of “ =” as an immediate assignment, and “ <=” as a delayed, concurrentassignment; shortly, we’ll explain the differences.The sensitivity list in the always block waits for one of two events to occur: either apositive edge on clock or a negative edge on reset. Think of a positive edge on a signalto be when it changes from a 0 to a 1, and a negative edge to be when a signal changesfrom a 1 to a 0. When one or both of these occur, the begin…end block is executed.Assume that a negative edge on reset occurs.

As the begin…end block begins executing, reset will be zero and thus currentState will be set to zero. As long as resetremains zero, even a positive edge on clock will only result in currentState being setto zero. This is the action of an asynchronous reset signal that overrides the clock on aftip ftop.Now consider the situation where reset is one and there is a positive edge on clock;the begin…end loop is executed but this time the else clause is taken. The assignmentThe Verilog Hardware Description Language18currentState <= nextState;loads currentState with the nextState. These statements model the positive edgetriggered behavior of a two-bit register made up of D-type ftip ftops.Now we can understand how the whole finite state machine model works.

Assumethat we are in state 0 (currentState is 0), reset is 1 (not asserted), clock is 0, and in is1. Given these values, then the two combinational outputs are: out is 0, and nextStateis 1. When the positive edge of the clock occurs, the second always block will executeand assign the value of nextState to currentState and then wait again for the nextpositive edge of clock or negative edge of reset. Since currentState just changed to 1,the first alway block will execute and calculate a new value for out and nextState. outwill become 1, and nextState will become 3 if in remains 1. If in becomes 0, the firstalways block will execute again, recalculating out and nextState independent of theclock edge; nextState will become 0, and out will become 0.References:@ 4.2; if 3.2; bit-select E.1, 3.2;1.3.2 Rules for Synthesizing Sequential SystemsIn addition to the rules listed in Section 1.2.2 for combinational circuits, there arerules for sequential systems.

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

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

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

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