VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.

Slides:



Advertisements
Similar presentations
Lecture 6 Chap 8: Sequential VHDL Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Advertisements

Quad 2-to-1 and Quad 4-to-1 Multiplexers Discussion D2.4 Example 7.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Generic Multiplexers: Parameters Discussion D2.5 Example 8.
VHDL ELEC 418 Advanced Digital Systems Dr. Ron Hayne Images Courtesy of Thomson Engineering.
Introduction to VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T1: Combinational Logic Circuits.
Integer Square Root.
FPGAs and VHDL Lecture L12.1. FPGAs and VHDL Field Programmable Gate Arrays (FPGAs) VHDL –2 x 1 MUX –4 x 1 MUX –An Adder –Binary-to-BCD Converter –A Register.
Counters Discussion D5.3 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
Introduction to VHDL CSCE 496/896: Embedded Systems Witawas Srisa-an.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
FPGAs and VHDL Lecture L13.1 Sections 13.1 – 13.3.
VHDL And Synthesis Review. VHDL In Detail Things that we will look at: –Port and Types –Arithmetic Operators –Design styles for Synthesis.
Finite State Machines Discussion D8.1 Example 36.
ECE 545 Lecture 7 Behavioral Modeling of Sequential-Circuit Building Blocks Mixing Design Styles Modeling of Circuits with a Regular Structure.
A.7 Concurrent Assignment Statements Used to assign a value to a signal in an architecture body. Four types of concurrent assignment statements –Simple.
1 H ardware D escription L anguages Modeling Complex Systems.
VHDL Introduction. V- VHSIC Very High Speed Integrated Circuit H- Hardware D- Description L- Language.
ELEC / Computer Architecture and Design Fall 2009 ELEC / Computer Architecture and Design Fall 2009 Modeling for Synthesis.
CprE / ComS 583 Reconfigurable Computing
Copyright © 1997 Altera Corporation & 提供 What is VHDL Very high speed integrated Hardware Description Language (VHDL) –is.
ENG241 Digital Design Week #8 Registers and Counters.
Mixed Style RTL Modeling
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
Digital System Projects
 Seattle Pacific University EE Logic System DesignCounters-1 Shift Registers DQ clk DQ DQ ShiftIn Q3Q3 Q2Q2 DQ Q1Q1 Q0Q0 A shift register shifts.
1 Part III: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Data Storage VHDL ET062G & ET063G Lecture 4 Najeem Lawal 2012.
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL VHDL Coding for Synthesis ECE 448 Lecture 12.
CDA 4253 FPGA System Design Sequential Circuit Building Blocks Hao Zheng Dept of Comp Sci & Eng USF.
ECE DIGITAL LOGIC LECTURE 20: REGISTERS AND COUNTERS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/19/2015.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Data Flow and Behavioral Modeling in VHDL 1 MS EMBEDDED SYSTEMS.
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
Sequential statements (1) process
Combinational logic circuit
Describing Combinational Logic Using Processes
Registers and Counters
Figure 7.1 Control of an alarm system
B e h a v i o r a l to R T L Coding
Part II A workshop by Dr. Junaid Ahmed Zubairi
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Part IV: VHDL CODING.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Sequential-Circuit Building Blocks
Algorithmic State Machine (ASM) Charts: VHDL Code & Timing Diagrams
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
VHDL VHSIC Hardware Description Language VHSIC
RTL Style در RTL مدار ترتيبي به دو بخش (تركيبي و عناصر حافظه) تقسيم مي شود. مي توان براي هر بخش يك پروسس نوشت يا براي هر دو فقط يك پروسس نوشت. مرتضي صاحب.
VHDL (VHSIC Hardware Description Language)
VHDL Structural Architecture
ECE 545 Lecture 6 Behavioral Modeling of Sequential-Circuit Building Blocks Mixing Design Styles Modeling of Circuits with a Regular Structure.
CPE 528: Lecture #5 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
ECE 545 Lecture 11 Design of Controllers Finite State Machines and Algorithmic State Machine (ASM) Charts.
Behavioral Modeling of Sequential-Circuit Building Blocks
Sequntial-Circuit Building Blocks
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
Figure 8.1. The general form of a sequential circuit.
ECE 545 Lecture 9 Behavioral Modeling of Sequential-Circuit Building Blocks Mixing Design Styles Modeling of Circuits with a Regular Structure.
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Sequntial-Circuit Building Blocks
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
(Sequential-Circuit Building Blocks)
EEL4712 Digital Design (Midterm 1 Review).
Presentation transcript:

VHDL in 1h Martin Schöberl

AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget the simulation explanation VHDL is complex We use only a small subset

AK: JVMHWVHDL3 Signals are Wires Use std_logic std_logic_vector (n downto 0) unsigned Variables Elegant for some constructs Easy to produce too much logic Avoid them

AK: JVMHWVHDL4 Synchronous Design Register Clock, reset Combinatorial logic And, or,… +, - =, /=, >,…

AK: JVMHWVHDL5 Register Changes the value on the clock edge process(clk) begin if rising_edge(clk) then reg <= data; end if; end process;

AK: JVMHWVHDL6 Register with Reset Usually has an asynchronous reset process(clk, reset) begin if (reset='1') then reg <= " "; elsif rising_edge(clk) then reg <= data; end if; end process;

AK: JVMHWVHDL7 Combinational Logic Simple expressions as signal assignment Concurrent statement a <= b; c <= a and b;

AK: JVMHWVHDL8 Combinational Logic Complex expressions in a process Sequential statement Input signals in the sensitivity list Assign a value to the output for each case process(a, b) begin if a=b then equal <= '1'; gt <= '0'; else equal <= '0'; if a>b then gt <= '1'; else gt <= '0'; end if; end process;

AK: JVMHWVHDL9 Defaults for Combinational process(a, b) begin equal <= '0'; gt <= '0'; if a=b then equal <= '1'; end if; if a>b then gt <= '1'; end if; end process;

AK: JVMHWVHDL10 Constants Single bit ’0’ and ’1’ Use for std_logic Bit arrays ”0011” Use for std_logic_vector and unsigned Integer: 1, 2, 3 Use for integer, unsigned

AK: JVMHWVHDL11 Example: Counter signal reg : std_logic_vector(7 downto 0); signal count : std_logic_vector(7 downto 0); begin -- the adder process process(reg) begin count <= std_logic_vector(unsigned(reg) + 1); end process; -- the register process process(clk, reset) begin if reset='1' then reg '0'); elsif rising_edge(clk) then reg <= count; end if; end process; -- assign the counter to the out port dout <= reg;

AK: JVMHWVHDL12 Counter in a Single Process -- we now use unsigned for the counter signal reg : unsigned(7 downto 0); begin -- a single process: process(clk, reset) begin if reset='1' then reg '0'); elsif rising_edge(clk) then reg <= reg + 1; end if; end process; -- assign the counter to the out port dout <= std_logic_vector(reg);

AK: JVMHWVHDL13 Quiz 1 process(a, b, sel) begin if sel='0' then data <= a; else data <= b; end if; end process; A 2:1 Multiplexer

AK: JVMHWVHDL14 Quiz 2 process(sel, a, b, c, d) begin case sel is when "00" => data <= a; when "01" => data <= b; when "10" => data <= c; when others => data <= d; end case; end process; 4:1 Multiplexer (Mux)

AK: JVMHWVHDL15 Quiz 3 process(sel) begin case sel is when "00" => z <= "0001"; when "01" => z <= "0010"; when "10" => z <= "0100"; when "11" => z <= "1000"; when others => z <= "XXXX"; end case; end process; 2 to 4 decoder

AK: JVMHWVHDL16 Quiz 4 process(clk, reset) begin if reset='1' then reg '0'); elsif rising_edge(clk) then if en='1' then reg <= data; end if; end process; Register with enable

AK: JVMHWVHDL17 Quiz 5 process(data, en) begin if en='1' then reg <= data; end if; end process; A Latch! VERY bad…

AK: JVMHWVHDL18 User defined types State machine states Operation type type rgb_type is (red, green, blue); signal color : rgb_type; begin color <= red;

AK: JVMHWVHDL19 A simple ALU type op_type is (op_add, op_sub, op_or, op_and); signal op : op_type; begin process(op, a, b) begin case op is when op_add => result <= a + b; when op_sub => result <= a - b; when op_or => result <= a or b; when others => result <= a and b; end case; end process;

AK: JVMHWVHDL20 File structure library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity alu is port ( clk, reset : in std_logic; a_in, b_in : in std_logic_vector(7 downto 0); dout : out std_logic_vector(7 downto 0) ); end alu; architecture rtl of alu is signal a, b : unsigned(7 downto 0);... begin a <= unsigned(a_in); dout <= std_logic_vector(result); process(op, a, b) begin... end process; end rtl;

AK: JVMHWVHDL21 Adder as Component library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity add is port ( a, b : in std_logic_vector(7 downto 0); dout : out std_logic_vector(7 downto 0) ); end add; architecture rtl of add is signal result : unsigned(7 downto 0); signal au, bu : unsigned(7 downto 0); begin au <= unsigned(a); bu <= unsigned(b); result <= au + bu; dout <= std_logic_vector(result); end rtl;

AK: JVMHWVHDL22 Component Use Declaration component add is port ( a : in std_logic_vector(7 downto 0); b : in std_logic_vector(7 downto 0); dout : out std_logic_vector(7 downto 0) ); end component add; Instantiation cmp_add: add port map (a_in, b_in, sum);

AK: JVMHWVHDL23 Component library ieee; … entity alu is … end alu; architecture rtl of alu is component add is port ( a, b : in std_logic_vector(7 downto 0); dout : out std_logic_vector(7 downto 0) ); end component add; signal a, b : unsigned(7 downto 0); signal sum : std_logic_vector(7 downto 0); begin a <= unsigned(a_in); cmp_add : add port map (a_in, b_in, sum);... end rtl;

AK: JVMHWVHDL24 State Machine architecture rtl of sm1 is type state_type is (green, orange, red); signal state_reg : state_type; signal next_state : state_type; begin -- state register process(clk, reset) begin if reset='1' then state_reg <= green; elsif rising_edge(clk) then state_reg <= next_state; end if; end process; -- output of state machine process(state_reg) begin if state_reg=red then ring_bell <= '1'; else ring_bell <= '0'; end if; end process; -- next state logic process(state_reg, bad_event, clear) begin next_state <= state_reg; case state_reg is when green => if bad_event = '1' then next_state <= orange; end if; when orange => if bad_event = '1' then next_state <= red; end if; when red => if clear = '1' then next_state <= green; end if; end case; end process; end rtl;

AK: JVMHWVHDL25 State Machine architecture rtl of sm2 is type state_type is (green, orange, red); signal state_reg : state_type; signal next_state : state_type; begin -- state register process(clk, reset) begin if reset='1' then state_reg <= green; elsif rising_edge(clk) then state_reg <= next_state; end if; end process; -- next state logic and output process(state_reg, bad_event, clear) begin next_state <= state_reg; ring_bell <= '0'; case state_reg is when green => if bad_event = '1' then next_state <= orange; end if; when orange => if bad_event = '1' then next_state <= red; end if; when red => ring_bell <= '1'; if clear = '1' then next_state <= green; end if; end case; end process; end rtl;

AK: JVMHWVHDL26 State Machine in one Process architecture rtl of sm3 is type state_type is (green, orange, red); signal state : state_type; begin -- single process process(clk, reset) begin if reset='1' then state <= green; ring_bell <= '0'; elsif rising_edge(clk) then case state is when green => if bad_event = '1' then state <= orange; end if; when orange => if bad_event = '1' then state <= red; ring_bell <= '1'; end if; when red => ring_bell <= '1'; if clear = '1' then state <= green; ring_bell <= ‘0'; end if; end case; end if; end process; end rtl;

AK: JVMHWVHDL27 Summary Think in hardware! Beware of unassigned pathes (latch!) Use simple types Use simple statements

AK: JVMHWVHDL28 More Information FAQ comp.lang.vhdl Mark Zwolinski, Digital System Design with VHDL.