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

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

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

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

There is a procedural version of the continuous assignmentstatement that allows for continuous assignments to be made to registers for certainspecified periods of time. Since the assignment is not in force forever, as is true withthe continuous assignment, we call this the procedural continuous assignment (thesewere called “quasi-continuous” in earlier versions of the manuals), While the procedural continuous assignment is in effect, the statement acts like a continuous assign.Concurrent Processes137Consider the example of a presetmodule dFlopand clear on a register shown in(inputpreset, clear,Example 4.12.

Note first that theoutput reg q,difference between continuous andinputclock, d);procedural continuous is immediately obvious from the context; thealwaysprocedural continuous assignment@(clear, preset)is a procedural statement executedbeginonly when control passes to it. (Theif(!clear)continuous assignment is always#10 assign q = 0;active, changing its outputs whenelse if (!preset)ever its inputs change.) In this#10 assign q = 1;example, the first always statementelsedescribes a process that reacts to a#10 deassign q;change in either the clear or presetendsignals. If clear becomes zero, thenwe assign register q to be zero. Ifalwayspreset becomes zero, then we assign@(negedge clock)register q to be one. When a changeq = #10 d;occurs and neither are zero, then weendmoduledeassign q (essentially undoing theprevious procedural continuous Example 4.12 Flip Flop With ProceduralContinuous Assignmentassignment), and then q can beloaded with a value using the normal clock method described by the second always statement.The general form of the assignment is:statementprocedural_continuous_assignmentsprocedural_continuous_assigmnentassign variable_assignment;deassign variable_lvalue;variable_assignmentvariable_lvalue = expressionIt is important to note that the procedural continuous assignment overrides a normal procedural assignment to a register.

While the procedural continuous assignmentis in effect, the reg_assignment acts like a continuous assignment. Thus, even if thenegative edge of the clock occurred as watched for in the second always statement, theprocedural assignment of d to q would not take effect. Further, if the value of theright-hand side of a procedural continuous assignment changes (it was not a constant138The Verilog Hardware Description Languageas in the above example), then the left-hand side will follow it.

The value proceduralcontinuously assigned remains in the register after the deassignment.References: continuous assignment 6.3; procedural assignment 3.1; event control with or 4.2.14.9 Sequential and Parallel BlocksThe begin-end blocks that we have seen so far are examples of sequential blocks.Although their main use is to group multiple procedural statements into one compound statement, they also allow for the new definition of parameters, registers, andevent declarations when the begin-end blocks are named. Thus new local variablesmay be specified and accessed within a named begin-end block.An alternate version module microprocessor;of the sequential beginalwaysend block is the parallelbeginor fork-join block shownresetSequence;below.

Each statement infork: mainWorkthe fork-join block is aforeverseparate process thatfetchAndExecuteInstructions;begins when control is@(posedge reset)passed to the fork. Thedisable mainWork;join waits for all of thejoinprocesses to completeendbefore continuing with endmodulethenextstatementbeyond the fork-join Example 4.13 An Illustration of the Fork-Join Blockblock.This example illustrates the description of an asynchronous reset restarting a process.

A resetSequence initializes registers and then begins the fork-join block namedmainWork. The first statement of the fork is a forever loop that describes the mainbehavior of the microprocessor. The second statement is the process that watches forthe positive edge of the reset signal. When the positive edge of the reset occurs, themainWork block is disabled.

As described previously, when a block is disabled, everything in the named block is disabled and execution continues with the next statement,in this case the next iteration of the always statement. Thus, no matter what was happening in the fetch and execute behavior of the system, the reset is able to asynchronously restart the whole system.The general form for the parallel block is given below.

Like the named (sequential)blocks previously described, naming the block allows for the optionalblock_declarations that can introduce new names for the scope of the block.Concurrent Processes139statementpar_blockpar_blockfork [: block _identifier { block_item_declaration } ]{ statement}joinblock_item_declarationparameter_declarationlocal_parameter_declarationinteger_declarationreal_declarationtime_declarationrealtime_declarationevent_declarationExample 4.14 shows a less abstractuseof thefork-joinblock.Example 4.11 has been rewritten, thistime with a single always that includesa fork-join.module simpleTutorialWithReset(inputclock, reset,output reg [7:0] y, x_;Again, it is important to note thatwe consider each of the statements ofthe fork-join as a separate process.This example essentially replaced twoalways statements by one that has afork-join.ComparingbacktoExample 4.11 serves to enforce furtherthe notion that each statement in thefork-join should be considered, at leastconceptually, a separate process.always fork: main@(negedge reset)disable main;beginwait (reset);@(posedge clock) x <= 0;i = 0;while (i <= 10) begin@(posedge clock);x <= x + y;i = i + 1;end@(posedge clock);if (x < 0)y<=0;else x <= 0;endjoinendmoduleReferences: named blocks 4.6reg[7:0]i;Example 4.14 Fork-Join Version of SimpleTutorial ExampleThe Verilog Hardware Description Language1404.10 Exercises4.1Will the following two fragments of Verilog code result in the same behavior?Why or why not?@(posedge exp)#1 statement1;4.2wait (exp)#1 statement 1;Rewrite the consumer and producer modules in Examples 4.6 at the behaviorallevel, such that a common clock signal controls the timing of the data transferbetween the modules.

On consecutive positive clock edges, the following is tohappen: 1) the producer sets up the data on its output, 2) the consumer reads thedata, 3) the producer sets up its next data value, and so on.For the design to be valid there needs to be a suitable power-on initializationmechanism. Find a solution to this and include it in the model.4.3 Extend Examples 4.6 to include internal processing between the consumer andproducer parts that is a simple increment operation with a delay of 10 timeunits.

Connect an instance of this module in a loop such that data can flowaround the loop forever with data being incremented each time around. Addextra code to initialize the model for execution (See figure, top of next page).4.4 Consider four named events: e1, e2, e3, and e. Write a description to triggerevent e after e1, e2, and e3 have occurred in a strict sequence Namely, if anyevent goes out of order the sequence is to be reset. Then, write a description totrigger event e after e1, e2, and e3 have each occurred three times in any order.4.5The following combinational logic block has three inputs and an output. Thecircuit was built in some screwy technology and then analyzed.

We now want toinsert the correct input-to-output timing information into the circuit (internalnode timings need not be correct).Concurrent Processes141Here are the circuit timings that must be represented in the circuit.The delay of a rising or falling edge on a or b to output f: 15 time unitsThe delay of a rising or falling edge on c to output f: 10 time unitsYes, those times are rather strange given the logic diagram.

However, this is ascrewy technology and the transistor implementation made for some strange,but actual, time delays.Assume a, b, and c are outputs of synchronously clocked flip flops. Write thebehavioral Verilog description that will be correct in functionality and timing.4.6 For the pipeline processor in Example 4.10, add part of the instruction decodelogic (i.e., like the case statement in the execute stage) into the fetch stage.

Useit instead of the skip variable to determine how to load the pc.4.7 For the mark1PipeStage module in Example 4.10, write an initial statementthat will load the processor’s memory and execute several instructions. Add amonitor statement and other initializations and clocking as needed. Write aprogram with the given machine instructions that will execute the followingpseudo code:142The Verilog Hardware Description Languageif ((m[4] - m[5]) < 0)m[4] = 17;elsem[4] = -10;4.8 Add a third stage to the pipeline of Example 4.10. The second stage should onlyfetch operands; values read from memory should be put in a memory data register (mdr).

The third stage will execute the instructions, loading the resulting values (mdr) in acc, pctemp, or m. Assume that the memory has multiple read andwrite ports. Handle any interstage conflicts that may arise.5Module HierarchyA structural model of a digital system uses Verilog module definitions to describearbitrarily complex elements composed of other modules and gate primitives. As wehave seen in earlier examples, a structural module may contain a combination ofbehavioral modeling statements (an always statement), continuous assignment statements (an assign statement), or module instantiations referencing other modules orgate level primitives.

By using module definitions to describe complex modules, thedesigner can better manage the complexity of a design. In this chapter we exploremodule hierarchy and how it is specified as we cover instantiation, parameterizedmodules, and iterative generation.5.1 Module Instantiation and Port SpecificationsA port of a module can be viewed as providing a link or connection between twoitems, one internal to the module instance and one external to it. We have seennumerous examples of the specification of module ports.An input port specifies the internal name for a vector or scalar that is driven by anexternal entity.

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

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

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

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