Building hierarchical designs in Verilog

Similar documents
Arrayed instantiation and generate constructs

Laboratory Exercise 1

Combinational Logic II

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 09 MULTIPLEXERS

ECE UMass, Amherst. Verilog tutorial

Hardware Description Languages (HDLs) Verilog

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Digital Design with FPGAs. By Neeraj Kulkarni

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

CSE370 TUTORIAL 3 - INTRODUCTION TO USING VERILOG IN ACTIVE-HDL

Multi cycle Processor Modification

Introduction. Purpose. Intended Audience. Conventions. Close

EECS 270 Midterm Exam

Writing Circuit Descriptions 8

Module 2.1 Gate-Level/Structural Modeling. UNIT 2: Modeling in Verilog

Combinational Logic Circuits


FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

Course Topics - Outline

Laboratory Exercise 3

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

EECS 151/251A Homework 1

Contents. Appendix D Verilog Summary Page 1 of 16

P-1/26. Samir Palnitkar. Prentice-Hall, Inc. INSTRUCTOR : CHING-LUNG SU.

ENGR 3410: Lab #1 MIPS 32-bit Register File

Chapter 4. Combinational Logic

Verilog Design Principles

Verilog Tutorial. Verilog Fundamentals. Originally designers used manual translation + bread boards for verification

TUTORIAL #2 HIERARCHICAL DESIGNS AND TEST FIXTURES

Hardware design of a CORDIC unit

Verilog Tutorial 9/28/2015. Verilog Fundamentals. Originally designers used manual translation + bread boards for verification

Chapter 2a: Structural Modeling

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

Combinational Logic. Prof. Wangrok Oh. Dept. of Information Communications Eng. Chungnam National University. Prof. Wangrok Oh(CNU) 1 / 93

ECE 551: Digital System Design & Synthesis

Verilog Essentials Simulation & Synthesis

Laboratory Exercise #6 Introduction to Logic Simulation and Verilog

Digital Design using HDLs EE 4755 Midterm Examination

Design Using Verilog

Brief Introduction to Verilog HDL (Part 1)

Introduction to Verilog HDL. Verilog 1

ELEC 2200 Digital Logic Circuits

Verilog Design Principles

HW1 Modeling Concepts

Verilog Module 1 Introduction and Combinational Logic

This Lecture. Some components (useful for the homework) Verilog HDL (will continue next lecture)

Digital Electronics & Computer Engineering (E85)

Chap 6 Introduction to HDL (d)

Modules, ports, instantiation

VHDL Sample Slides Rev Sample Slides from the 2-day and 4-day VHDL Training Courses

Nikhil Gupta. FPGA Challenge Takneek 2012

ECE 152A LABORATORY 2

Introduction to CMOS VLSI Design (E158) Lab 4: Controller Design

Federal Urdu University of Arts, Science and Technology, Islamabad VLSI SYSTEM DESIGN. Prepared By: Engr. Yousaf Hameed.

register:a group of binary cells suitable for holding binary information flip-flops + gates

In this lecture, we will go beyond the basic Verilog syntax and examine how flipflops and other clocked circuits are specified.

8. Best Practices for Incremental Compilation Partitions and Floorplan Assignments

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

EE183 LAB TUTORIAL. Introduction. Projects. Design Entry

ECE 4514 Digital Design II. Spring Lecture 3: Verilog Bread and Butter

Department of Electrical Engineering McGill University ECSE 221 Introduction to Computer Engineering Assignment 2 Combinational Logic

A Brief Introduction to Verilog Hardware Definition Language (HDL)

ECE2029: Introduction to Digital Circuit Design Lab 3 Implementing a 4-bit Four Function ALU

CS150 Fall 2012 Solutions to Homework 6

Using Library Modules in Verilog Designs

EECS150 - Digital Design Lecture 8 - Hardware Description Languages

Sunburst Design - Verilog-2001 Design & Best Coding Practices by Recognized Verilog & SystemVerilog Guru, Cliff Cummings of Sunburst Design, Inc.

EE 4755 Digital Design Using Hardware Description Languages

Last Name Student Number. Last Name Student Number

Area Efficient, Low Power Array Multiplier for Signed and Unsigned Number. Chapter 3

Course Topics - Outline

EE 8351 Digital Logic Circuits Ms.J.Jayaudhaya, ASP/EEE

a, b sum module add32 sum vector bus sum[31:0] sum[0] sum[31]. sum[7:0] sum sum overflow module add32_carry assign

ECE 353 Lab 3 (Verilog Design Approach)

Introduction to Verilog. Garrison W. Greenwood, Ph.D, P.E.

ECEN 468 Advanced Logic Design

Course Topics - Outline

ENGR 3410: MP #1 MIPS 32-bit Register File

Lecture 15: System Modeling and Verilog

University of California, Davis Department of Electrical and Computer Engineering. EEC180B DIGITAL SYSTEMS Spring Quarter 2018

Counters, Timers and Real-Time Clock

One and a half hours. Section A is COMPULSORY UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE

Memory System Design. Outline

(Refer Slide Time: 00:01:53)

Laboratory Exercise 9

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

CS429: Computer Organization and Architecture

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

Verilog for Combinational Circuits

Keywords: HDL, Hardware Language, Digital Design, Logic Design, RTL, Register Transfer, VHDL, Verilog, VLSI, Electronic CAD.

Verilog introduction. Embedded and Ambient Systems Lab

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Tutorial on Verilog HDL

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

Department of Computer Science & Engineering. Lab Manual DIGITAL LAB. Class: 2nd yr, 3rd sem SYLLABUS

Music. Numbers correspond to course weeks EULA ESE150 Spring click OK Based on slides DeHon 1

Chapter 3 Part 2 Combinational Logic Design

Introduction to Verilog design. Design flow (from the book) Hierarchical Design. Lecture 2

Transcription:

Building hierarchical designs in Verilog Arhitectura Calculatoarelor/Computer Architecture October 15, 2017

Verilog hierarchies Objectives: Learn how to instantiate a module Construct a design hierarchy Hierarchical design - Facilitates design of complex architectures - Promote design reuse Instance: a module used as a component in a larger module. An instances has: A module: provides the definition of the instance. A container: the module in which the instance is created. Creating a new instance is referred to as instantiation.

Instantiation An instance is constructed by providing the following: the module to be instantiated, followed by an instance name (to differentiate from other instances of the same module), followed by a list of port connections List of port connections specifies to which signals from container are instance s ports linked. A port connection is specified like:.<module_port>(<container_signal>), in which module port is a port of the instantiated module container signal is an internal signal or a port from container

4-to-1 multiplexer Exercise: Build a 4-to-1 multiplexer out of 2-to-1 multiplexers. Solution: The architecture of the 4-to-1 multiplexer using three 2-to-1 multiplexer modules is depicted bellow. Data input, d, is on 4 lines and the 2-bit selection line, s, propagates one bit of the data input to the output, o. For example, if s = (1, 0), input line d[2] is propagated to o.

4-to-1 multiplexer (contd.) The Verilog code implementing the 4-to-1 multiplexer s architecture is presented bellow: 1 module mux 2s 1b ( 2 i n p u t [ 3 : 0 ] d, 3 i n p u t [ 1 : 0 ] s, 4 output o 5 ) ; 7 w i r e f ; 8 w i r e g ; 10 mux 1s 1b mux1 ( 11. d0 ( d [ 0 ] ), 12. d1 ( d [ 1 ] ), 13. s ( s [ 0 ] ), 14. o ( f ) 15 ) ; 17 mux 1s 1b mux2 ( 18. d0 ( d [ 2 ] ), 19. d1 ( d [ 3 ] ), 20. s ( s [ 0 ] ), 21. o ( g ) 22 ) ; 24 mux 1s 1b mux3 ( 25. d0 ( f ), 26. d1 ( g ), 27. s ( s [ 1 ] ), 28. o ( o ) 29 ) ; 30 endmodule

4-to-1 multiplexer (contd.) Analyzing the first instance created in the 4-to-1 multiplexer code above the components of an instantiation can observed: the module to be instantiated is mux 1s 1b (it must be the name of an existing Verilog module) the instance name is mux1 (it must be a valid Verilog ID) the list of port connections, within round parentheses (more details in the following slide) 10 mux 1s 1b mux1 ( 11.d0(d[0]), 12.d1(d[1]), 13.s(s[0]), 14.o(f) 15 ) ;

4-to-1 multiplexer (contd.) Detail of the mux_2s_1 emphasizing the mux1 instance and its connections: 10 mux 1s 1b mux1 11. d0 ( d[0] ), 12. d1 ( d [ 1 ] ), 13. s ( s [ 0 ] ), 14. o ( f ) 15 ) ; Elements of the first port connection: d0 - port of the mux_1s_1 module for the connection in line of code 11 is constructed d[0] - signal inside the mux_2s_1 container ( d[0] is a container s port, thus a signal in the container ) to which port d0 is connected

4-to-1 multiplexer (contd.) Internal wires link internal instances connect one instance s output to another instance s input must be declared inside the container module as wires Internal wire declaration for the mux_2s_1b architecture: 7 w i r e f ; 8 w i r e g ;

4-to-1 multiplexer (contd.) f Verilog code bellow connects mux1 s output, o, to wire f (left) connects mux3 s input, d0, to wire f (right) 10 mux 1s 1b mux1 ( 11. d0 ( d [ 0 ] ), 12. d1 ( d [ 1 ] ), 13. s ( s [ 0 ] ), 14.o(f) 15 ) ; 24 mux 1s 1b mux3 ( 25.d0(f), 26. d1 ( g ), 27. s ( s [ 1 ] ), 28. o ( o ) 29 ) ;

4-to-1 multiplexer (contd.) Important: When connecting a wire to a port, the widths must match! If the two ports to be connected have different widths, choose for the width of the connecting wire the width of one of them. For connecting the wire to the other port: if the wire has fewer lines and the other port is an output, some of the outputs line will remain unconnected if the wire has fewer lines and the other port to which it connects is an input, use concatenation to provide the needed extra input lines (eg..x({4 d0, data}),) if the wire has more lines and the other port to which it connects is an input, use part-select to provide only the needed input lines (eg..s(addr[15:14]),) if the wire has more lines and the other port to which it connects is an output, use part-select to provide only the needed output lines (eg..z(next_addr[7:0]),)

Three-to-eight-lines decoder with enable input Exercise: Build a decoder device with three selection lines, an enable input and active low outputs using decoder components with two selection lines, enable input and active low outputs. Solution: The architecture of the three-to-eight-lines decoder, dec_3x8, is depicted bellow.

Three-to-eight-lines decoder with enable input (contd.) Justification: Since the three-to-eight-lines decoder has 8 output lines it follows that 2 two-to-four-lines decoder components, dec_2x4 are needed for providing the required number of outputs. Input lines s[1 : 0] are used as selection lines for the 2 dec_2x4 units so that the units 4 output lines to be addressed by consecutive configurations. Selection line s[2] activates only one of the two dec_2x4 modules assuring proper sequencing of the two groups of 4 output lines generated at the dec_2x4 units outputs. The dedicated enable line activates selection of one of the two dec_2x4 decoders. The three-to-eight-lines decoder architecture uses: 2 two-to-four-lines decoders, dec_2x4 2 AND gates and, an inverter

Three-to-eight-lines decoder with enable input (contd.) Verilog code for the three-to-eight-lines decoder 1 module d e c 3 x 8 ( 2 i n p u t e, 3 i n p u t [ 2 : 0 ] s, 4 output [ 7 : 0 ] y 5 ) ; 7 d e c 2 x 4 i 1 ( 8. s ( s [ 1 : 0 ] ), 9. e ( e & s [ 2 ] ), 10. y ( y [ 7 : 4 ] ) 11 ) ; 13 d e c 2 x 4 i 2 ( 14. s ( s [ 1 : 0 ] ), 15. e ( e & ( s [ 2 ] ) ), 16. y ( y [ 3 : 0 ] ) 17 ) ; 18 endmodule