ECE 437 Computer Architecture and Organization Lab 6: Programming RAM and ROM Due: Thursday, November 3

Similar documents
Lab 4: Register File and Memory 50 points Instructor: Yifeng Zhu Due: One week

ECE 473 Computer Architecture and Organization Project: Design of a Five Stage Pipelined MIPS-like Processor Project Team TWO Objectives

Laboratory Exercise 8

Designing with ESBs in APEX II Devices

Final Project: MIPS-like Microprocessor

Digital Systems Design

DKAN0011A Setting Up a Nios II System with SDRAM on the DE2

lpm_rom Megafunction User Guide

University of Florida EEL 3701 Drs. Eric M. Schwartz & Karl Gugel. Quartus ROM Creation Instructions (in Quartus Prime Lite 17.1)

NIOS CPU Based Embedded Computer System on Programmable Chip

Lab 6: Integrated the Decoder with Muti-bit Counter and Programming a FPGA

Laboratory 4 Design a Muti-bit Counter

Laboratory Exercise 7

Laboratory 4 Design a Muti-bit Counter and Programming a FPGA

ENGR 2031 Digital Design Laboratory Lab 7 Background

Lab 2 EECE473 Computer Organization & Architecture University of Maine

Laboratory Exercise 9

L10: Major/Minor FSMs, Lab 3, and RAM/ROM Instantiation

Digital Systems Laboratory

Digital Systems Laboratory

On-Chip Memory Implementations

ALTERA FPGAs Architecture & Design

Chapter 2: Hardware Design Flow Using Verilog in Quartus II

NIOS CPU Based Embedded Computer System on Programmable Chip

4DM4 Lab. #1 A: Introduction to VHDL and FPGAs B: An Unbuffered Crossbar Switch (posted Thursday, Sept 19, 2013)

Tutorial for Altera DE1 and Quartus II

University of Massachusetts Amherst Computer Systems Lab 1 (ECE 354) LAB 1 Reference Manual

CPE 200L LABORATORY 4: INTRODUCTION TO DE2 BOARD UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND:

FPGA Development Board Hardware and I/O Features

Introduction to the Altera SOPC Builder Using Verilog Design

Introduction to the Altera SOPC Builder Using Verilog Designs. 1 Introduction

Quick Tutorial for Quartus II & ModelSim Altera

Lab 4 Report. Single Cycle Design BAOTUNG C. TRAN EEL4713C

9. Building Memory Subsystems Using SOPC Builder

University of Massachusetts Amherst Computer Systems Lab 2 (ECE 354) Spring Lab 1: Using Nios 2 processor for code execution on FPGA

4. TriMatrix Embedded Memory Blocks in HardCopy IV Devices

CSC / EE Digital Systems Design. Summer Sample Project Proposal 01

ECE-6170 Embedded Systems Laboratory Exercise 3

ALTERA FPGA Design Using Verilog

Laboratory Exercise 5

Nios Soft Core Embedded Processor

Terasic DE0 Field Programmable Gate Array (FPGA) Development Board

Introduction to VHDL Design on Quartus II and DE2 Board

COMP 303 MIPS Processor Design Project 3: Simple Execution Loop

2. TriMatrix Embedded Memory Blocks in Stratix II and Stratix II GX Devices

Embedded Memory Blocks in Arria V Devices

Verilog HDL: Behavioral Counter

Figure 2.1 The Altera UP 3 board.

Name EGR 2131 Lab #6 Number Representation and Arithmetic Circuits

Laboratory Exercise 3

Digital Systems Laboratory

Using Library Modules in Verilog Designs

8. Migrating Stratix II Device Resources to HardCopy II Devices

Digital Design LU. Lab Exercise 1

(a) Implement processor with the following instructions: addi, sw, lw, add, sub, and, andi, or, ori, nor, sll, srl, mul

Verilog for High Performance

2. Stratix II Architecture

Using the SDRAM on Altera s DE1 Board with Verilog Designs. 1 Introduction. For Quartus II 13.0

Implementing PLL Reconfiguration in Stratix & Stratix GX Devices

Project Description EEC 483 Computer Organization, Spring 2019

Phase-Locked Loop Reconfiguration (ALTPLL_RECONFIG) Megafunction

Stratix. Introduction. Features... Programmable Logic Device Family. Preliminary Information

Generic Serial Flash Interface Intel FPGA IP Core User Guide

CSE P567 - Winter 2010 Lab 1 Introduction to FGPA CAD Tools

Zet x86 open source SoC

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

The simplest form of storage is a register file. All microprocessors have register files, which are known as registers in the architectural context.

Problem Set 10 Solutions

White Paper Using the MAX II altufm Megafunction I 2 C Interface

SERDES Transmitter/Receiver (ALTLVDS) Megafunction User Guide

Section I. Cyclone II Device Family Data Sheet

EE 231 Fall Lab 1: Introduction to Verilog HDL and Altera IDE

Simple Excalibur System

2. SDRAM Controller Core

University of Florida EEL 3701 Drs. K. Gugel & Eric M. Schwartz. MaxPlus II ROM Creation Instructions

Low Power Design Techniques

Digital Design and Computer Architecture

Implementing Double Data Rate I/O Signaling in Stratix & Stratix GX Devices. Introduction. DDR I/O Elements. Input Configuration

Stratix. Introduction. Features... 10,570 to 114,140 LEs; see Table 1. FPGA Family. Preliminary Information

Graduate Institute of Electronics Engineering, NTU Advanced VLSI SOPC design flow

CSE140 L. Instructor: Thomas Y. P. Lee. March 1, Agenda. Computer System Design. Computer Architecture. Instruction Memory design.

ALTERA M9K EMBEDDED MEMORY BLOCKS

Processor design - MIPS

Qsys and IP Core Integration

SERDES Transmitter/Receiver (ALTLVDS) Megafunction User Guide

Homework #4 Processor Core Design

Tutorial 3. Appendix D. D.1 Design Using Verilog Code. The Ripple-Carry Adder Code. Functional Simulation

Laboratory Exercise 6 Pipelined Processors 0.0

DDR and DDR2 SDRAM Controller Compiler User Guide

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180A DIGITAL SYSTEMS I Winter 2015

AN 367: Implementing PLL Reconfiguration in Stratix II Devices

PCI to SH-3 AN Hitachi SH3 to PCI bus

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

Using Library Modules in Verilog Designs. 1 Introduction. For Quartus II 13.0

COVER SHEET: Problem#: Points

Design Guidelines for Optimal Results in High-Density FPGAs

My First FPGA for Altera DE2-115 Board

R-type Instructions. Experiment Introduction. 4.2 Instruction Set Architecture Types of Instructions

White Paper. Floating-Point FFT Processor (IEEE 754 Single Precision) Radix 2 Core. Introduction. Parameters & Ports

Altera DE1 Board DE1. Development and Education Board. User Manual. Copyright 2006 Altera Corporation

Transcription:

Objectives: ECE 437 Computer Architecture and Organization Lab 6: Programming RAM and ROM Due: Thursday, November 3 Build Instruction Memory and Data Memory What to hand in: Your implementation source files. Submit your homework through the homework submission website. (Please do not email to my departmental email address.) Note: This is a group lab and you should work with your project partner. In the pipelined processor design, you need to use RAM on the DE2 boards for instruction memory and data memory, respectively. The following documents on the project website are helpful to access RAM. RAM Megafunction User Guide Using the SDRAM Memory on Altera s DE2 Board with VHDL or Verilog Design 1. The RAM Interface The DE2 board provides three types of memory, including 512-Kbyte SRAM, 8-Mbyte SDRAM and 4- Mbyte Flash memory. The SRAM is organized as 256K 16bits, the SDRAM is organized as 1M 16bits 4 banks, and the Flash memory is 8-bit data bus. The signals needed to communicate with this chip are shown in the figure below. All of the signals, except the clock, can be provided by the SDRAM Controller. The clock signal is provided separately. It has to meet the clock-skew requirements. Note that some signals are active low, which is denoted by the suffix N. 2. Using LPM to Access SDRAM and ROM You can use altsyncram LPM provide in Quartus II to access the RAM on the DE2 board. (Quartus II also provides lpm_ram_dq and lpm_rom functions, but they are only for backward compatibility. The altsyncram megafunction is recommended by Altera.) The following briefly summarizes the procedure of using altsyncram. 1

In this project, you need to create a new Quartus II projects to access. The target FPGA chip on the DE2 board is Cyclone II EP2C35F672C6. The tutorial Using Library Modules in VHDL Designs describes the usage of MegaWizard to build a desired LPM module. i. In the Memory Compiler category, you can find RAM: 1-PORT LPM ii. Select VHDL or Verilog HDL as the type of output file to create iii. Give the file the name ramlpm.vhd (for VHDL) or ramlpm.v (for verilog) iv. In the next windows, you can customize the RAM configurations, such as the width, clock. You can also initiate the values of RAM using a MIF file. The format of MIF is given in this handout. 2

The following notes are copied from Atlera s RAM Megafunction User Guide. The RAM: 1-PORT MegaWizard Plug-In Manager allows you to specify either of two clocking modes: a single clock mode or a dual clock (input/output) mode. In single clock mode, the read and write operations are synchronous with the same clock. In the Stratix and Cyclone series of devices, a single clock with a clock enable controls all registers of the memory block. Dual clock (input/output) mode operates with two independent clocks: inclock (input clock for write operation) and outclock (output clock for read operation). The input clock controls all registers related to the data input to the memory block, including data, address, byte enables, read enables, and write enables. The output clock controls the data output registers. Synchronous write operations into the memory block use the address[] and data[] ports, which are triggered by the rising edge of the inclock while the we (write enable) port is 3

enabled. For asynchronous operation, the address[] and data[] signals must be valid at both edges of the write enable signal. Ideally, the values on the data and address lines should not be changed while the we port is active. 3. Memory Initialization Format (MIF) The data of the RAM and Rom can be initialized according to an ASCII text file named Memory Initialization Format (with the extension.mif). The following gives two example MIF files. DEPTH = 256; % Memory depth and width are required % WIDTH = 16; % Enter a decimal number % ADDRESS _RADIX = HEX; % Address and value radixes are optional % DATA - RADIX = HEX; % Enter BIN, DEC, HEX, or OCT; unless % % otherwise specified, radixes = HEX % -- Specify initial data values for memory, format is address : data CONTENT BEGIN [00..FF] : 0000; % Range - Every address from 00 to FF = 0000 % -- Computer Program for A = B + C 00 : 0210; % LOAD A with MEM(10) % 01 : 0011; % ADD MEM(11) to A % 02 : 0112; % STORE A in MEM(12) % 03 : 0212; % LOAD A with MEM(12) check for new value of FFFF % 04 : 0304; % JUMP to 04 (loop forever) % 10 : AAAA; % Data Value of B % 11 : 5555; % Data Value of C % 12 : 0000; % Data Value of A - should be FFFF after running program $ END; Note: If multiple values are specified for the same address, only the last value is used. 4

4. Lab Instructions and Requirements 1. Build the Data Memory. a. You should be able to read and write SDRAM by using RAM: 1-PORT MegaWizard Plug-In Manager. The output of SDRAM is 32 bits. The SDRAM will be used as the data memory in the project. Note that we are using 32-bit wide data memory to simplify the design since we will use load word (lw). As a result, in one cycle, we can get the data out. b. In MegaWizard, both the input and output can be registered or not registered. First of all, make both registered and test it on the board. Then make the output not registered and test it again on the board. Find out the difference between registered and not registered. c. In MegaWizard, you can use single clock or dual clocks. The dual clocks have separated clocks for inputs and outputs. Make the right choice. d. Initialize the data memory as the following. Please note the data memory address in MIPS code is in terms of bytes, not words. Test your design on the Altera DE2 board using the display and control specification given at the end of this handout. e. Please note that in the MIPS programs, the data segment starts at 0x10000000. Since the data size of our test programs is small, thus you can ignore the most significant four bits in the data address. Address Code 1 0x10000000 0x00000001 2 0x10000004 0x00000002 3 0x10000008 0x00000003 4 0x1000000c 0x00000004 5 0x10000010 0x00000005 6 0x10000014 0x00000006 7 0x10000018 0x00000007 8 0x1000001c 0x00000008 9 0x10000020 0x00000009 10 0x10400024 0x0000000A 11 0x1000002c 0x0000000B 12 0x10000030 0x0000000C 13 0x10000044 0x0000000D 14 0x10000048 0x0000000E 15 0x1000004c 0x0000000F 16 0x10000050 0x00000010 5

2. Build the Instruction Memory. a. In the project built in Step 1, add a new component that can read ROM by using ROM: 1- PORT MegaWizard Plug-In Manager. The output of ROM is 32 bits. The ROM will be used as the instruction memory in the project. b. In MegaWizard, both the input and output can be registered or not registered. You need to make the right choice for both input and output. c. In MegaWizard, you can use single clock or dual clocks. The dual clocks have separated clocks for inputs and outputs. Make the right choice. d. Initialize the instruction memory as the following. Please note the instruction memory address in MIPS code is in terms of bytes, not words. Test your design on the Altera DE2 board using the display and control specification given at the end of this handout. e. Please note that in the MIPS programs, the instruction segment starts at 0x00400000. Since the data size of our test programs is small, thus you can ignore the most significant 12 bits in the data address. Instruction Address Code 1 add $3, $2, $1 0x00400000 0x00411820 2 addu $3, $2, $1 0x00400004 0x00411821 3 sub $3, $2, $1 0x00400008 0x00411822 4 subu $3, $2, $1 0x0040000c 0x00311823 5 and $3, $2, $1 0x00400010 0x00411824 6 or $3, $2, $1 0x00400014 0x00411825 7 nor $3, $2, $1 0x00400018 0x00411827 8 slt $3, $2, $1 0x0040001c 0x0041182a 9 sll $3, $2, 1 0x00400020 0x00021840 10 srl $3, $2, 1 0x00400024 0x00021842 11 jr $2 0x0040002c 0x00400008 12 nop 0x00400030 0x00000000 6

On Board Display and Control Setup INSTR=FFFFFFFF LCD Value = EEEEEEEE HEX7 HEX6 HEX5 HEX4 HEX4 HEX2 HEX1 HEX0 Toggle swiches Register, Instruction Memory or Data Memory Address Program Counter Clock Counter 17 16 15 17 = Clock Control 0: manual clock 1: 1Hz clock 15,16 = LCD Value 00: Register 01: Data 10: Instruction 14 13 12 11 10 SW[10-14] Instruction Memory Address 9 8 7 6 5 SW[5-9] Data Memory Address 4 3 2 1 SW[0-4] Register Address 0 Pushbutton Swiches 3 2 1 0 Manual Clock RESET The project is reset by the push button 0 (KEY[0]). The program counter (HEX5 and HEX4) shows the instruction memory address. The clock counter (HEX0-4) shows how many cycles you design has run and it starts from 0. The LCD has two rows. The first row shows the instruction addressed by the program counter (HEX5 and HEX4). The second row shows the value which is controlled by SW[15-16], which could be a value pointed by a register address SW[0-4], or a data memory address SW[5-9] or a instruction memory address SW[10-14]. The actual address should be shown in HEX7 and HEX6. Your lab should be able to run by using two different clocks: (1) a system 1-Hz clock and (2) a manual clock. Use the switch SW[17] to switch between these two clocks. (If SW[17] = 0, the system 1Hz clock is used. Otherwise the manual clock is used.) Using the system clock allows your code to automatically complete the test programs. The manual clock is generated by the push button 1 (KEY[1]). For each push, generate a HIGH signal for only one second no matter how long the push button is pressed. Note that the LCD still needs the on-board clock. 7

Part 2: Show your Results on LCD and LED Each digit should stay on the LCD for a sufficient amount of time so that we can read it. For example, you could set the clock rate to 0.5Hz. Then every 2 seconds, an Ulam number is shown on the LCD. The numbers should be dynamically shown on the screen, i.e., you cannot just show all numbers together at the first step. Similarly your results should also be shown on the LED simultaneously. A sample Clock, LED LCD driver will be provided. The following shows some diagram of some drivers. LED Controller Push bottom Debounce LCD controller Clock Divider The LCD_Display is used to display static ASCII characters and changing hex values from hardware on a two-line LCD display panel. Number_Hex_Digits is used to set the size of the Hex_Display_Data input. Each hex digit displayed requires a 4-bit signal. The reset signal should be active high whenever you want update the LCD display. Make sure that the pins LCD_ON and LCD_BLON are set as active high. These two pins are not set by the controller. You can find more information about the LCD controller in the course project website. LCD_E is actually LCD_EN. The debounce circuit is used to filter mechanical contact bounce in the DE2 s push buttons. A shift register is used to filter out the switch contact bounce. The shift register takes several time spaced samples of the push button input and changes the output only after several sequential samples are the same value. Clock is a clock signal of approximately 100Hz that is used for the internal 50ms switch debounce filter design. The pb_debounced is the output. The output will remain Low until the pushbutton is released. 8