Reset-able and Enable-able Registers

Similar documents
Memory in Digital Systems

VERILOG: FLIP-FLOPS AND REGISTERS

VERILOG 2: LANGUAGE BASICS

CSE140L: Components and Design Techniques for Digital Systems Lab

CAD for VLSI Design - I. Lecture 21 V. Kamakoti and Shankar Balachandran

Control in Digital Systems

CSE140L: Components and Design

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

Course Topics - Outline

ECEN 468 Advanced Logic Design

EEL 4783: HDL in Digital System Design

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

EECS150 - Digital Design Lecture 10 Logic Synthesis

EECS150 - Digital Design Lecture 10 Logic Synthesis

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Memory in Digital Systems

CSE 140L Final Exam. Prof. Tajana Simunic Rosing. Spring 2008

Digital Integrated Circuits

Last Lecture. Talked about combinational logic always statements. e.g., module ex2(input logic a, b, c, output logic f); logic t; // internal signal

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

Computer Aided Design Basic Syntax Gate Level Modeling Behavioral Modeling. Verilog

Simple Behavioral Model: the always block

Chapter 9: Sequential Logic Modules

Sequential Logic Design

Digital Integrated Circuits

Modeling Sequential Circuits in Verilog

EE178 Lecture Verilog FSM Examples. Eric Crabill SJSU / Xilinx Fall 2007

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

In this lecture, we will focus on two very important digital building blocks: counters which can either count events or keep time information, and

Verilog Module 1 Introduction and Combinational Logic

Topics. Midterm Finish Chapter 7

EECS 270 Verilog Reference: Sequential Logic

ECE 4514 Digital Design II. Spring Lecture 15: FSM-based Control

ECE 2300 Digital Logic & Computer Organization. More Finite State Machines

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

EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline

Verilog for High Performance

Verilog Behavioral Modeling

MEMORIES. Memories. EEC 116, B. Baas 3

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

Digital Design with FPGAs. By Neeraj Kulkarni

ALTERA M9K EMBEDDED MEMORY BLOCKS

Hardware Description Languages: Verilog

CSE 140L Final Exam. Prof. Tajana Simunic Rosing. Spring 2008

HDLs and SystemVerilog. Digital Computer Design

EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited

Memory in Digital Systems

Writing Circuit Descriptions 8

Chapter 9: Sequential Logic Modules

EN164: Design of Computing Systems Lecture 06: Lab Foundations / Verilog 2

CS6710 Tool Suite. Verilog is the Key Tool

Verilog introduction. Embedded and Ambient Systems Lab

Programmable Logic Devices Verilog VII CMPE 415

Digital Logic & Computer Design CS Professor Dan Moldovan Spring 2010

ECE 551: Digital System *

Verilog for Synthesis Ing. Pullini Antonio

VERILOG: TESTING. If you don t test it, it isn t going to work - Mark Horowitz

Lecture 32: SystemVerilog

Contents. Appendix D Verilog Summary Page 1 of 16

Memory in Digital Systems

VERILOG 5: TESTING. If you don t test it, it isn t going to work - Mark Horowitz

EE 231 Fall EE 231 Homework 8 Due October 20, 2010

EECS 427 Lecture 14: Verilog HDL Reading: Many handouts/references. EECS 427 W07 Lecture 14 1

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

Topics. Midterm Finish Chapter 7

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

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

EN164: Design of Computing Systems Lecture 07: Lab Foundations / Verilog 3

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Verilog For Synthesis

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

Chapter 5 Registers & Counters

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

Hardware Description Languages: Verilog. Quick History of HDLs. Verilog/VHDL. Design Methodology. Verilog Introduction. Verilog.

Memories. Design of Digital Circuits 2017 Srdjan Capkun Onur Mutlu.

Register Transfer Level

Quick Introduction to SystemVerilog: Sequental Logic

Nikhil Gupta. FPGA Challenge Takneek 2012

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis

Outline. EECS Components and Design Techniques for Digital Systems. Lec 11 Putting it all together Where are we now?

Digital Design with SystemVerilog

Verilog 1 - Fundamentals

EE-382M VLSI II. Early Design Planning: Front End

Tutorial 2 Implementing Circuits in Altera Devices

VERILOG 5: TESTING. If you don t test it, it isn t going to work - Mark Horowitz

Synthesizable Verilog

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

CMPE 415 Full and Parallel Case

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

Spiral 1 / Unit 6. Flip-flops and Registers

Chap 6 Introduction to HDL (d)

Synthesis of Combinational and Sequential Circuits with Verilog

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

Control and Datapath 8

Outline. EECS150 - Digital Design Lecture 5 - Verilog 2. Structural Model: 2-to1 mux. Structural Model - XOR. Verilog Basics Lots of Examples

A Brief Introduction to Verilog Hardware Definition Language (HDL)

Outcomes. Spiral 1 / Unit 6. Flip Flops FLIP FLOPS AND REGISTERS. Flip flops and Registers. Outputs only change once per clock period

VHDL for Synthesis. Course Description. Course Duration. Goals

ELCT 501: Digital System Design

Transcription:

VERILOG II

Reset-able and Enable-able Registers Sometimes it is convenient or necessary to have flip flops with special inputs like reset and enable When designing flip flops/registers, it is ok (possibly required) for there to be cases where the always block is entered, but the reg is not assigned No fancy code, just make it work Normally use synchronous reset instead of asynchronous reset (easier to test) enable D reset Q D Q B. Baas, EEC 281 196

Reset-able and Enable-able Registers Example FF with reset and enable (reset has priority) reset enable Action 0 0 Do nothing 0 1 D Flip Flop 1 0 Reset? or Do nothing? 1 1 Reset, Q=0 always @(posedge clk) begin if (reset) // highest priority out <= #1 1 b0; else if (enable) out <= #1 c_out; // ok if no assignment (out holds value) end B. Baas, EEC 281 197

Reset-able and Enable-able Registers Example FF with reset and enable (enable has priority) reset enable Action 0 0 Do nothing 0 1 D Flip Flop 1 0 Reset? or Do nothing? always @(posedge clk) begin 1 1 Reset, Q=0 if (enable) begin // highest priority if (reset) out <= #1 1 b0; else out <= #1 c_out; end // It is ok if there is no assignment to out in some // cases (out is not assigned when enable==0 in which // case out holds its value). Recall that this is never // ok for combinational logic. end B. Baas, EEC 281 198

Reset-able and Enable-able Registers Use reset able FFs only where needed Reset able FFs are a little larger and higher power Requires the global routing of the high fanout reset signal reset only these two registers, but now reset must be enabled for at least 3 clock cycles R R x + cos() reset B. Baas, EEC 281 199

Three types of case statements in verilog 1) case Normal case statement 2) casez Allows use of wildcard? character for don t cares. casez(in) 4 b1???: out = a; 4 b01??: out = b; 4 b00??: out = c; default: out = d; endcase 3) casex Don t use it for 281. It can use z or x logic. default It may be wise to set the output to a special value even if you expect the state machine will never reach these default values Setting unused states to x should allow the synthesis tool to simplify logic Setting unused states to an easily recognizable value (such as x s) could make mistakes easier to spot B. Baas, EEC 281 200

Hardwired Complex Functions Complex or arbitrary functions are not uncommon Examples sin, cos, tan tangent 1 log e x A/D converter correction values RF mixer bias values theta sin/cos out_real out_imag B. Baas, EEC 281 201

Hardwired Complex Functions Two main approaches to implement complex functions High precision numerical calculations Almost certainly requires many clock cycles per calculation 1 2 bits per clock cycle is common. In some cases, more bits/cycle are possible by adding hardware Can regain throughput by parallel implementations However latency is unavoidable and may be less desirable Ex: CORDIC, polynomial expansions, etc. Lookup tables ROM array memory Real memory with address decoder, wordlines, bitlines, sense amplifiers, etc. Frequently available as macros from the standard cell vendor Could be mask defined at manufacture, one time programmable with fuses or anti fuses, or off chip Flash Synthesized from standard cell logic B. Baas, EEC 281 202

Hardwired Function in Verilog using a Lookup Table ROM array memories Generally perform better with very large tables since ROM cells are among the densest of all CMOS structures Lookup tables Generally perform better with data that is less random (in an entropy information theory sense) Less random data results in simpler and smaller logic equations always @(input) begin case (input) 4 b0000: begin real=3 b100; imag=3 b001; end 4 b0001: begin real=3 b000; imag=3 b101; end 4 b0010: begin real=3 b110; imag=3 b011; end... default: begin real=3 bxxx; imag=3 bxxx; end endcase end B. Baas, EEC 281 203

Hardwired Function in Verilog using a Lookup Table It is usually best to write a matlab program to print the verilog table as plain text You will need several versions to get it right so rapid generation is a huge help matlab has rock solid common functions, rounding, etc. matlab has superb plotting capabilities for checking all sorts of characteristics such as bias, frequency response, etc. Easy to adapt to other specifications such as binary word width, number format, etc. Print everything between case and endcase then copy & paste the output into your verilog file Helpful commands: fprintf( \n, x, out_real, out_imag); num2bin B. Baas, EEC 281 204

Lookup Tables with Cascaded Functions In many cases, computation is expressed or can be transformed into cascaded functions Example: The angle of a rectangular 2D vector = tan 1 (y/x) A straightforward implementation using lookup tables would use a table for division followed by a table for tan 1 () A better implementation would merge the cascaded functions into a single tan 1 (y/x) function implemented with a single memory Assuming the intermediate result y/x is not needed elsewhere In both cases, the input address is the concatenated address = {x, y} or {y, x}; in fact, the bits can be mixed arbitrarily although the two forms shown certainly are the clearest Address {real,imag} {real,imag} Memory x/y Read Data Memory tan -1 (x/y) Memory tan -1 ( ) angle B. Baas, EEC 281 205 angle

Working With Signed Values IEEE Verilog 1364 2001 allows wires and regs to be declared signed which makes signed arithmetic much much easier Unfortunately, it will be many years before all CAD tools fully support this feature Therefore, in EEC 281, write all *.v hardware verilog code without declaring wires or regs signed. Anything is ok in your test code. In practice, it would be wise to run test cases on the particular mix of CAD tools used in a design before using signed regs or wires B. Baas, EEC 281 206