联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2019-02-15 10:18

CSCI 2121: Computer Organization and

Assembly Language

Lab 4

Design Sequential Circuits in Verilog II

Thursday 14th February, 2019

1 Learning Objectives

In this lab, you will learn to interpret Verilog for testbenches.

You will learn case statements, serial and parallel data transfer.

You will implement a vending machine.

2 Submission Instruction

Save code for each task as .sv file, with the name specified at the end of each lab task.

Put all lab files into one folder, and compress the folder to a .zip file.

Submit it on Brightspace.

Deadline for submission: Sunday 17th February, 2019, 11:55 pm.

As the marking will be done automatically by a script, it is important that you follow

these instructions and save your files with correct names and .sv extension.

1

3 Lab Assignment

3.1 Lab Task 1: Frequency Divider

A frequency divider takes only a clock as input, which constantly alternates producing 1

and 0, and produces a lower frequency alternating signal. We will make a circuit to quarter the

input rate. Every time the clock pulses four times, we would like to set our output to be the

opposite of the current output. To do this, we will negate our output when the clock’s state

is 0. In order to keep track of four clock pulses, we need two state bits. The skeleton code is

available at https://www.edaplayground.com/x/5hDr. Name your file as task1.sv

Hint: you can use either if. . . else, or case, or  (ternary operator) to complete the always

block.

3.2 Lab Task 2: Vending Machine

Using previous knowledge of sequential circuits, you will now construct a vending machine

controller according to the following specifications. The circuit has four inputs: clk, quarter,

loonie, and toonie. The controller also has two outputs: change and dispense. Change

is a 3-bit bus which outputs a binary number indicating the number of quarters to dispense.

Dispense is a single on/off wire. You must implement the controller based on the following

properties. The skeleton code is available at https://www.edaplayground.com/x/2at. Name

your file as task2.sv

1. The item (and change, if any) is dispensed when $1 is inserted into the machine.

2. Change outputs a binary number indicating the number of quarters to dispense.

3. The dispense and change signals are set to 1 on the same clock tick that the amount is

met.

Note: In the lecture, you designed sequential circuits using 6 steps from specification to

minimizing the circuit. In Verilog, however, you need to mainly focus on the specification and

the state transition diagram. The rest of the circuit design is done with high-level Verilog

statements.

Figure 1: Vending Machine


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp