Document Version: 0.6 Document Date: 15 April 2011 Prepared by: Y. Ermoline for ATLAS Level-1Calorimeter Trigger

Similar documents
In our case Dr. Johnson is setting the best practices

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

Assignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture

VHDL for Complex Designs

Lecture 4. VHDL Fundamentals. George Mason University

VHDL in 1h. Martin Schöberl

The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below:

VHDL for FPGA Design. by : Mohamed Samy

Hardware Modeling. VHDL Basics. ECS Group, TU Wien

Inferring Storage Elements

Introduction to VHDL #1

Control and Datapath 8

Lecture 12 VHDL Synthesis

Digital Systems Design

TKT-1212 Digitaalijärjestelmien toteutus. Lecture 7: VHDL Testbenches Ari Kulmala, Erno Salminen 2008

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized

Getting Started with VHDL

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

Reconfigurable Hardware Design (coursework)

Subprograms, Packages, and Libraries

Hardware Description Language VHDL (1) Introduction

EECE-4740/5740 Advanced VHDL and FPGA Design. Lecture 3 Concurrent and sequential statements

Basic Language Elements

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. George Mason University

Quartus Counter Example. Last updated 9/6/18

Summary of FPGA & VHDL

Hardware Description Languages. Modeling Complex Systems

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Assignment 01 Computer Architecture Lab ECSE

ECE 545 Lecture 4. Simple Testbenches. George Mason University

Basic Language Constructs of VHDL

Contents. Appendix D VHDL Summary Page 1 of 23

Altera s Avalon Communication Fabric

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

[VARIABLE declaration] BEGIN. sequential statements

CONCURRENT STATEMENTS COMPONENT DECLARATION COMPONENT INSTANTIATION

Constructing VHDL Models with CSA

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) -

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

Lecture 9. VHDL, part IV. Hierarchical and parameterized design. Section 1 HIERARCHICAL DESIGN

ECE 448 Lecture 4. Sequential-Circuit Building Blocks. Mixing Description Styles

Lecture 4. VHDL Fundamentals. Required reading. Example: NAND Gate. Design Entity. Example VHDL Code. Design Entity

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

Experiment 8 Introduction to VHDL

COVER SHEET: Total: Regrade Info: Problem#: Points. 7 (14 points) 6 (7 points) 9 (6 points) 10 (21 points) 11 (4 points)

EEE8076. Reconfigurable Hardware Design (coursework) Module Outline. Dr A. Bystrov Dr. E.G. Chester. Autumn

Introduction to VHDL. Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez

Lab # 5. Subprograms. Introduction

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit

VHDL And Synthesis Review

VHDL: Modeling RAM and Register Files. Textbook Chapters: 6.6.1, 8.7, 8.8, 9.5.2, 11.2

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

CCE 3202 Advanced Digital System Design

Combinational Logic COMB. LOGIC BLOCK. A Combinational Logic Block is one where the outputs depend only on the current inputs

Simulation with ModelSim Altera from Quartus II

Lab 3. Advanced VHDL

Essential VHDL for ASICs

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2

vhdl-style-guide Documentation

Introduction to VHDL. Main language concepts

Simulation with ModelSim Altera from Quartus II

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

FPGA Design. Part III - Combinatorial VHDL. Thomas Lenzi

CSCI 262 C++ Style Guide

Design Guidelines for Using DSP Blocks

COE Design Process Tutorial

Sequential Statement

EENG 2910 Project III: Digital System Design. Due: 04/30/2014. Team Members: University of North Texas Department of Electrical Engineering

VHDL simulation and synthesis

EEL 4712 Digital Design Test 1 Spring Semester 2008

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden

COVER SHEET: Total: Regrade Info: 5 (5 points) 2 (8 points) 6 (10 points) 7b (13 points) 7c (13 points) 7d (13 points)

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution March 2, 2006

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

Tri-State Bus Implementation

EITF35: Introduction to Structured VLSI Design

Chapter 6 Combinational-Circuit Building Blocks

Review of Digital Design with VHDL

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

PACKAGE. Package syntax: PACKAGE identifier IS...item declaration... END PACKAGE [identifier]

VHDL: A Crash Course

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

Introduction to VHDL #3

Menu. Introduction to VHDL EEL3701 EEL3701. Intro to VHDL

CprE 583 Reconfigurable Computing

Pollard s Tutorial on Clocked Stuff in VHDL

Schedule. ECE U530 Digital Hardware Synthesis. Rest of Semester. Midterm Question 1a

Logic Implementation on a Xilinx FPGA using VHDL WWU Linux platform assumed. rev 10/25/16

Design Guidelines for Using DSP Blocks

1. Using the for-generahon scheme, concurrent statements can be replicated a predetermined number of times.

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques

Working With Design Files 3

5. 0 VHDL OPERATORS. The above classes are arranged in increasing priority when parentheses are not used.

EEL 4712 Digital Design Test 1 Spring Semester 2007

Sequential Logic - Module 5

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University

COVER SHEET: Total: Regrade Info: 5 (14 points) 7 (15 points) Midterm 1 Spring 2012 VERSION 1 UFID:

Concurrent Signal Assignment Statements (CSAs)

VHDL Simulation. Testbench Design

The CPU Bus : Structure 0

Transcription:

ATLAS ATL-DA-EN-0004 EDMS Id: 1100579 ATLAS TDAQ Level-1 Calorimeter Trigger VHLD guidelines Document Version: 0.6 Document Date: 15 April 2011 Prepared by: Y. Ermoline for ATLAS Level-1Calorimeter Trigger Document Change Record Version Issue Date Comment 0 5 16 November 2009 Final draft for comments 0 6 15 April 2011 Adder reference to CERN VHDL coding guidelines Abstract: page 1

ATLAS TDAQ Level-1 Calorimeter Trigger Version/Issu 0.6 TABLE OF CONTENTS INTRODUCTION 3 GENERAL REQUIREMENTS 3 NAMING CONVENTIONS 4 HEADER 5 LIBRARY DECLARATION 5 ENTITY DECLARATION 6 ARCHITECTURE DECLARATION 6 CONSTANT DECLARATIONS 7 COMPONENT DECLARATIONS 7 SIGNAL DECLARATIONS 7 COMPONENT INSTANCES PORT MAP 8 PROCESSES 8 COMBINATORIAL EXPRESSIONS 8 PACKAGES 9 AKNOWLEGEMENT 10 REFERENCES 10 page 2

Version/Issue: 0.6 ATLAS TDAQ Level-1 Calorimeter Trigger INTRODUCTION There are two levels of advice in this document: Rules, which must be obeyed, Recommendations, which designers are encouraged to follow for their own benefit. GENERAL REQUIREMENTS Rule: a VHDL file must contain no more than one component (entity and architecture) or one library. Rule: the code must contain a maximum of one statement per line. Recommendation: lines of code should be no more than 80 characters long. data <= moddata when modden = '1' else (others => 'Z' Rule: code must be properly indented to indicate the hierarchy of entities, architectures, processes, loops, etc. The depth of the indentation must be consistent throughout the code Recommendation: space characters should be used rather than tabs to indent the code. Recommendation: inline comments should be indented and aligned to enhance readability. entity vmeif is port ( data: inout std_logic_vector(31 downto 0 -- VME data bus clk: in std_logic -- FPGA clock end vmeif; Recommendation: related constructs should be grouped together, and these groups should be separated using blank lines or lines made of dashes where this increases the readability. signal vmeadh: std_logic; -- VME base address high signal vmeadl: std_logic; -- VME base address low signal vmeam: std_logic_vector(5 downto 0 -- VME address modifier page 3

ATLAS TDAQ Level-1 Calorimeter Trigger Version/Issu 0.6 NAMING CONVENTIONS Rule: all design objects (entities, ports, signals, components etc.) must be given meaningful, noncryptic names, consistent throughout the design. Example 1 Recommendation: port names should begin with an Uppercase letter. Recommendation: signal names should be written in lowercase letter Recommendation: active low ports and signals should have names ending with _n. entity vmeif is port ( Data: inout std_logic_vector(31 downto 0 -- VME data bus Reset_n: in std_logic; -- FPGA reset Clk: in std_logic -- FPGA clock end vmeif; architecture rtl of vmeif is -- VME bus signals signal vmeadh_n: std_logic; -- base address high signal vmeadl_n: std_logic; -- base address low signal vmeam: std_logic_vector(5 DOWNTO 0 -- address modifier begin end rtl; Example 2 Recommendation: all invented design objects names - entity, architecture, ports, signals, constants, variables, labels (components, processes, etc.), types, states, etc. should be written in UPPERCASE letters. Recommendation: only ports of the top entity (connected to the FPGA pins) and ports of the components, directly connected to these pins during instantiation, can be active low signals and should have names ending with _L or _N. Recommendation: all signals in the design should be active high signals. Any active low port should be converted to the signal with the same name without _L or _N. entity VMEIF is port ( DATA: inout std_logic_vector(31 downto 0 -- VME data bus RESET_N: in std_logic; -- FPGA reset pin CLK: in std_logic -- FPGA clock pin end VMEIF; architecture RTL of VMEIF is -- VME bus signals signal RESET: std_logic; -- internal FPGA reset begin RESET <= not RESET_N; -- pin to signal end RTL; page 4

Version/Issue: 0.6 ATLAS TDAQ Level-1 Calorimeter Trigger HEADER Rule: at the beginning of a VHDL file there must be a header with the following information: The name of the VHDL entity (name of design Name of the original author; The date of creation and last modification; A brief but clear description of the design s function (comments A list of modifications (date of modification, the change made, the author of the change). Recommendation: an email address of the original author may be included in the header. -- Design : VMEIF -- Author : Name FAMILYNAME -- Created : 01.01.2001 Last Modified: 01.03.2001 -- Comments : VME interface A24:D32; AM:3E,3D,3A,39; no BLT; -- 01.02.2001 : first modification details; Name FAMILYNAME -- 01.03.2001 : second modification details; Name FAMILYNAME LIBRARY DECLARATION library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use std.textio.all; use ieee.std_logic_textio.all; page 5

ATLAS TDAQ Level-1 Calorimeter Trigger Version/Issu 0.6 ENTITY DECLARATION Rule: the top-level entity must have the same name as the device or hardware modelled. Rule: where possible, ports must be given the same name as appears in the device specification. Recommendation: legal VHDL names should be used in the device specification document. Rule: signal types other than std_logic or std_logic_vector must not be used for component ports. Recommendation: do not declare more than one generic and port per line, each declaration should be followed by a comment clarifying the nature and use of the port, unless this is obvious. entity VMEIF is generic ( WIDTH: integer:=32 -- generic parameter port ( DATA: inout std_logic_vector(31 downto 0 -- VME data bus RESET_N: in std_logic; -- FPGA reset pin CLK: in std_logic -- FPGA clock pin end VMEIF; ARCHITECTURE DECLARATION Recommendation: each VHDL architecture should begin with a header comment that contains the following: a description of the function of the architecture; a description of any limitations that the architecture might have; a note of any assumptions made during the design process; descriptions of any generic parameters. architecture RTL of VMEIF is -- header (functions, limitations, assumptions, generics) -- constant declarations, component declarations, signal declarations begin -- component instances, processes, combinatorial expressions end RTL; page 6

Version/Issue: 0.6 ATLAS TDAQ Level-1 Calorimeter Trigger CONSTANT DECLARATIONS Rule: constant parameters with meaningful names must be used to avoid burying magic numbers within VHDL architecture. constant VERSION: std_logic_vector(1 downto 0):="10"; -- ver.2 constant REVISION: std_logic_vector(1 downto 0):="11"; -- rev.3 COMPONENT DECLARATIONS Rule: the identifier, port clause and generic clause of a component declaration must be identical to the declarations in the corresponding entity declaration (i.e. the same identifiers in the same order). component VMEIF generic ( WIDTH: integer:=32 -- generic parameter port ( DATA: inout std_logic_vector(31 downto 0 -- VME data bus CLK: in std_logic -- FPGA clock end component; Recommendation: after all components have been declared, a configuration statement should explicitly specify from what library and file each component should be instantiated SIGNAL DECLARATIONS Recommendation: do not end signal names with an integer. Recommendation: signals should be grouped together; one signal per line, each declaration should be followed by a comment clarifying the nature and use of the signal, unless this is obvious. signal VMEADH: std_logic; -- VME base address high signal VMEADL: std_logic; -- VME base address low signal VMEAM: std_logic_vector(5 downto 0 -- VME address modifier signal RESET: std_logic; -- internal FPGA reset Recommendation: where possible, the same name for a signal throughout all levels of a design should be used. In cases where exactly the same name cannot be used, for example when two identical subcomponents have been instantiated, use names derived from the same root. page 7

ATLAS TDAQ Level-1 Calorimeter Trigger Version/Issu 0.6 COMPONENT INSTANCES PORT MAP Rule: named association (rather than positional association) must be used to define the port maps of component instances. Recommendation: when instantiating a component, the instance name should be descriptive. -- VME interface port map VME_INTERFACE: VMEIF port map ( DATA => VMEDATA, RESET_N => RESET_N, -- FPGA reset pin CLK => FPGA_CLK PROCESSES Rule: all processes must be named. Recommendation: there should be some description for each "process" block in the architecture ------------------------------------------------------------------------------ -- VME signals register ------------------------------------------------------------------------------ VME_SIGNALS_REGISTERS: process (CLK) begin if rising_edge(clk) then --... end if; end process VME_SIGNALS_REGISTERS; COMBINATORIAL EXPRESSIONS Rule: brackets must be used to enhance the readability of algebraic and Boolean equations. e := (a * b) + (c * d) -- variable calculation page 8

Version/Issue: 0.6 ATLAS TDAQ Level-1 Calorimeter Trigger PACKAGES Rule: a package declaration must contain full documentation (in comments) about the declared types, constants, subprograms etc.. Recommendation: do not use names such as my_package everybody will have a different version of my_package, which will create problems when sharing code package VME_PKG is -- data types -- constants -- components -- sub routines end VME_PKG; page 9

ATLAS TDAQ Level-1 Calorimeter Trigger Version/Issu 0.6 AKNOWLEGEMENT This is compiled with the help of Ian Brawn, Sam Silverstein and the other members of the Level-1 Calorimeter Trigger collaboration. REFERENCES [1] Ian Brawn, VHDL style guide, version 1.1, 31 May 2006 [2] Patrick Loschmidt et al., Guidelines for VHDL Coding, rev18, 30 Oct. 2010 http://www.ohwr.org/documents/24 page 10