Digital Design with Synthesizable VHDL
|
|
|
- Esmond Farmer
- 10 years ago
- Views:
Transcription
1 Digital Design with Synthesizable VHDL Prof. Stephen A. Edwards Columbia University Spring 2012
2 Combinational Logic in a Dataflow Style Hierarchy: Instantiating Components (entities) Combinational Logic in a Procedural Style Sequential Logic FSMs Summary of the Three Modeling Styles Ten Commandments of VHDL Writing Testbenches
3 Why HDLs? 1970s: SPICE transistor-level netlists An XOR built from four NAND gates Vdd.MODEL P PMOS.MODEL N NMOS.SUBCKT NAND A B Y Vdd Vss M1 Y A Vdd Vdd P M2 Y B Vdd Vdd P M3 Y A X Vss N M4 X B Vss Vss N.ENDS X1 A B I1 Vdd 0 NAND X2 A I1 I2 Vdd 0 NAND X3 B I1 I3 Vdd 0 NAND X4 I2 I3 Y Vdd 0 NAND A B A B X1 Vss X2 I1 X3 Y I2 I3 X4 Y
4 Why HDLs? 1980s: Graphical schematic capture programs
5 Why HDLs? 1990s: HDLs and Logic Synthesis library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity ALU is port(a: in unsigned(1 downto 0); B: in unsigned(1 downto 0); Sel: in unsigned(1 downto 0); Res: out unsigned(1 downto 0)); end ALU; architecture behv of ALU is process (A,B,Sel) case Sel is when "00" => Res <= A + B; when "01" => Res <= A + (not B) + 1; when "10" => Res <= A and B; when "11" => Res <= A or B; when others => Res <= "XX"; end case; end process; end behv;
6 Two Separate but Equal Languages Verilog and VHDL Verilog: More succinct, less flexible, really messy VHDL: Verbose, very (too?) flexible, fairly messy Part of languages people actually use identical. Every synthesis system supports both.
7 Basic Lexical Rules of VHDL Free-form: space only separates tokens. Case-insensitive: VHDL, vhdl, and vhdl are equivalent. Comments: from -- to the end of the line. Identifiers: [a-za-z](_?[a-za-z0-9])* Examples: X X_or_Y ADDR addr Illegal: 14M CLK 4 FOO_
8 Literals in VHDL Decimal integers : _1203 Based integers : 2#1_0010# 16#F001D# Characters: 0 1 X Strings: "101011" "XXXXXX" Bit string literals : B"1001_0101" X"95" mean " " Underscores added for readability are ignored
9 Combinational Logic in a Dataflow Style
10 Bits Logical True False Binary 1 0 Voltage V V Timing Diagram VHDL 1 0 In VHDL, zeros and ones on wires are members of an enumerated type. They are not Boolean.
11 The std_logic_1164 package package std_logic_1164 is type std_ulogic is ( U, -- Uninitialized X, -- Forcing Unknown 0, -- Forcing 0 1, -- Forcing 1 Z, -- High Impedance W, -- Weak Unknown L, -- Weak 0 H, -- Weak Don t care ); -- The std_logic type allows tri-state drivers (preferred) subtype std_logic is resolved std_ulogic; -- Lots more...
12 Boolean Operators The basic ones in VHDL: a b a and b a or b not a a b a nand b a nor b a xor b
13 Rules of Boolean Algebra (1) -- Precedence not a or b and c = (not a) or (b and c) -- Basic relationships not not a = a a and 1 = a a and 0 = 0 a or 1 = 1 a or 0 = a a and a = a a and not a = 0 a or a = a a or not a = 1 a nand b = not (a and b) a nor b = not (a or b) a xor 0 = a a xor 1 = not a a xor b = (not a and b) or (a and not b)
14 Rules of Boolean Algebra (2) -- Commutativity a and b = b and a a or b = b or a -- Associativity a and (b and c) = (a and b) and c a or (b or c) = (a or b) or c -- Distributivity a and (b or c) = a and b or a and c a or (b and c) = (a or b) and (a or c) -- De Morgan s Law not (a and b) = not a or not b not (a or b) = not a and not b
15 A Full Adder: Truth Table a b c carry sum carry <= (not a and b and c) or ( a and not b and c) or ( a and b and not c) or ( a and b and c); sum <= (not a and not b and c) or (not a and b and not c) or ( a and not b and not c) or ( a and b and c); Each row represents a minterm Sum-of-products form: sum of each minterm in which output is true
16 Simplifying Using Boolean Rules carry <= (not a and b and c) or (a and not b and c) or (a and b and not c) or (a and b and c); <= (a and b and not c) or (a and b and c) or (not a and b and c) or (a and b and c) or (a and not b and c) or (a and b and c); <= (a and b) or (b and c) or (a and c); sum <= (not a and not b and c) or (not a and b and not c) or (a and not b and not c) or (a and b and c); <= (not a) and ((not b and c) or (b and not c)) or a and ((not b and not c) or (b and c)); <= a xor b xor c;
17 Structure of a VHDL Module PORTS in in out PROCESS process (clk) if rising_edge(clk) then count <= count + 1; end process; DATAFLOW EXPRESSION X <= 1 when Y = 1 and X = "110"else 0 out inout SIGNAL COMPONENT
18 A Full Adder in VHDL library ieee; use ieee.std_logic_1164.all; -- always needed -- std_logic, et al. entity full_adder is -- the interface port(a, b, c : in std_logic; sum, carry : out std_logic); end full_adder; architecture imp of full_adder is -- the implementation sum <= (a xor b) xor c; -- combinational logic carry <= (a and b) or (a and c) or (b and c); end imp; carry c b a sum carry c a b sum
19 ...After Logic Synthesis b c carry~3 a carry~0 carry~4 carry carry~1 sum~1 sum
20 Vectors of Bits Three standard synthesizable bit vector types: Type Library Logic Arith. Neg. std_logic_vector ieee_std_1164 unsigned numeric_std signed numeric_std library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity vectors is port(vect : in std_logic_vector(1 downto 0); unsi : in unsigned(7 downto 0); sign : out unsigned(15 downto 0)); end entity;
21 Endianness The perpetual battle: Is 0 most or least significant? Little Endian unsigned(3 downto 0) Big Endian unsigned(0 to 3) Arguments on both sides will continue forever. I suggest using Little Endian for vectors.
22 Binary and Hexadecimal in VHDL Dec. Binary Hex 0 "0" x"0" 1 "1" x"1" 2 "10" x"2" 3 "11" x"3" 4 "100" x"4" 5 "101" x"5" 6 "110" x"6" 7 "111" x"7" 8 "1000" x"8" 9 "1001" x"9" 10 "1010" x"a" 11 "1011" x"b" 12 "1100" x"c" 13 "1101" x"d" 14 "1110" x"e" 15 "1111" x"f" 16 "10000" x"10" 17 "10001" x"11" 18 "10010" x"12" 19 "10011" x"13" Vector types are arrays of std_logic Literals are therefore strings of 0 s and 1 s -- from std_logic_1164 type std_logic_vector is array (natural range <>) of std_logic; --- from numeric_std type unsigned is array (natural range <>) of std_logic; type signed is array (natural range <>) of std_logic;
23 Two s Complement Dec. Binary Hex -8 "1000" x"8" -7 "1001" x"9" -6 "1010" x"a" -5 "1011" x"b" -4 "1100" x"c" -3 "1101" x"d" -2 "1110" x"e" -1 "1111" x"f" 0 "0000" x"0" 1 "0001" x"1" 2 "0010" x"2" 3 "0011" x"3" 4 "0100" x"4" 5 "0101" x"5" 6 "0110" x"6" 7 "0111" x"7" How do you represent negative numbers? Two s complement produces simpler logic than sign bit alone. Idea: Add constant 2 n to negative numbers. Simply discard overflow after addition or subtraction. An n-bit number represents 2 n 1 to 2 n 1 1. The signed type in numeric_std uses this
24 A Hex-to-seven-segment Decoder a f b g e c d
25 VHDL: Hex-to-7-segment Decoder library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; -- Provides the unsigned type entity hex7seg is port ( input : in unsigned(3 downto 0); -- A number output : out std_logic_vector(6 downto 0)); -- Just bits end hex7seg; architecture combinational of hex7seg is with input select output <= " " when x"0", " " when x"1", -- Bad style " " when x"2", " " when x"3", -- one case " " when x"4", " " when x"5", -- per line " " when x"6", " " when x"7", -- preferred " " when x"8", " " when x"9", " " when x"a", " " when x"b", " " when x"c", " " when x"d", " " when x"e", " " when x"f", "XXXXXXX" when others; end combinational;
26 Four-to-one mux: when.. else library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity multiplexer_4_1 is port(in0, in1, in2, in3 : in unsigned(15 downto 0); s : in unsigned(1 downto 0); z : out unsigned(15 downto 0)); end multiplexer_4_1; architecture comb of multiplexer_4_1 is z <= in0 when s = "00" else in1 when s = "01" else in2 when s = "10" else in3 when s = "11" else (others => X ); -- Shorthand for "all X s" end comb;
27 Four-to-one mux: with...select library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity multiplexer_4_1 is port(in0, in1, in2, in3 : in unsigned(15 downto 0); s0, s1 : in std_logic; z : out unsigned(15 downto 0)); end multiplexer_4_1; architecture comb of multiplexer_4_1 is signal sels : unsigned(1 downto 0); sels <= s1 & s0; -- "&" is vector concatenation with sels select -- would not resolve type if "s1 & s0" here z <= in0 when "00", in1 when "01", in2 when "10", in3 when "11", (others => X ) when others; end comb;
28 Three-to-eight Decoder library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity dec1_8 is port ( sel : in unsigned(2 downto 0); res : out unsigned(7 downto 0)); end dec1_8; architecture comb of dec1_8 is res <= " " when sel = "000" else " " when sel = "001" else " " when sel = "010" else " " when sel = "011" else " " when sel = "100" else " " when sel = "101" else " " when sel = "110" else " "; end comb;
29 Priority Encoder library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity priority is port ( sel : in std_logic_vector(7 downto 0); code : out unsigned(2 downto 0)); end priority; architecture imp of priority is code <= "000" when sel(0) = 1 else "001" when sel(1) = 1 else "010" when sel(2) = 1 else "011" when sel(3) = 1 else "100" when sel(4) = 1 else "101" when sel(5) = 1 else "110" when sel(6) = 1 else "111"; end imp;
30 Integer Arithmetic library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity adder is port ( A, B : in unsigned(7 downto 0); CI : in std_logic; SUM : out unsigned(7 downto 0); CO : out std_logic); end adder; architecture imp of adder is signal tmp : unsigned(8 downto 0); tmp <= A + B + ("0" & ci); -- trick to promote ci to unsigned SUM <= tmp(7 downto 0); CO <= tmp(8); end imp;
31 A Very Simple ALU library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity alu is port ( A, B : in unsigned(7 downto 0); ADD : in std_logic; RES : out unsigned(7 downto 0)); end alu; architecture imp of alu is RES <= A + B when ADD = 1 else A - B; end imp;
32 Arithmetic Comparison library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity comparator is port ( A, B : in unsigned(7 downto 0); GE : out std_logic); end comparator; architecture imp of comparator is GE <= 1 when A >= B else 0 ; end imp;
33 Tri-state drivers How to use a pin as both an input and output. Not for internal FPGA signals. library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity tri_demo is port(addr : out unsigned(15 downto 0); -- output only data : inout unsigned(7 downto 0)); -- bidirectional end tri_demo; architecture rtl of tri_demo is signal oe : std_logic; -- output enable: control direction of data signal d_out : unsigned(7 downto 0); data <= d_out when oe = 1 else -- Drive data to chip (others => Z ); -- Read data from external chip end rtl;
34 Syntax of Expressions Logical operators: and or xor nand nor Relational operators: = /= < <= > >= Additive operators: + - & (concatenation) Multiplicative operators: * / mod rem Others: abs not ** (exponentiation) Primaries: identifier literal name(expr to expr) name(expr downto expr) ( choice ( choice ) => expr )
35 Summary of Dataflow Modeling Conditional signal assignment (when...else) target <= (expr when expr else) expr ; Selected signal assignment (with...select) with expr select target <= (expr when choice ( choice),) expr when choice ( choice) ; A choice is a simple expression (i.e., not logical or comparison) or others. Note: when does not nest (i.e., it s not an expr).
36 Hierarchy: Instantiating Components (entities)
37 Hierarchy: port map positional style library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity add2 is port (A, B : in unsigned(1 downto 0); C : out unsigned(2 downto 0)); end add2; architecture imp of add2 is component full_adder port (a, b, c : in std_logic; sum, carry : out std_logic); end component; A(1) B(1) a b c carry bit1 sum C(2) C(1) signal carry : std_logic; bit0 : full_adder port map ( A(0), B(0), 0, C(0), carry ); bit1 : full_adder port map ( A(1), B(1), carry, C(1), C(2) ); A(0) B(0) 0 a b c carry bit0 sum carry C(0) end imp;
38 Hierarchy: port map by-name style library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity add2n is port (A, B : in unsigned(1 downto 0); C : out unsigned(2 downto 0)); end add2n; architecture imp of add2n is component full_adder port (a, b, c : in std_logic; sum, carry : out std_logic); end component; signal carry : std_logic; bit0 : full_adder port map (a => A(0), b => B(0), c => 0, sum => C(0), carry => carry); bit1 : full_adder port map (a => A(1), b => B(1), c => carry, sum => C(1), carry => C(2)); end imp;
39 Direct Instantiation (no component) library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity add2 is port (A, B : in unsigned(1 downto 0); C : out unsigned(2 downto 0)); end add2; architecture imp of add2 is signal carry : std_logic; bit0 : entity work.full_adder -- everything in "work" project port map ( A(0), B(0), 0, C(0), carry ); bit1 : entity work.full_adder port map ( A(1), B(1), carry, C(1), C(2) ); end imp; Must be compiled after full_adder.vhd!
40 Generate: Ripple-carry adder library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity rippleadder is port (a, b : in unsigned(3 downto 0); cin : in std_logic; sum : out unsigned(3 downto 0); cout : out std_logic); end rippleadder; architecture imp of rippleadder is signal c : unsigned(4 downto 0); c(0) <= cin; G1: for m in 0 to 3 generate -- expanded at compile time sum(m) <= a(m) xor b(m) xor c(m); c(m+1) <= (a(m) and b(m)) or (b(m) and c(m)) or (a(m) and c(m)); end generate G1; cout <= c(4); end imp;
41 Combinational Logic in a Procedural Style
42 Processes Process: sequential code fragment invoked when signal in sensitivity list changes. A correct, but dumb way to model an inverter: library ieee; use ieee.std_logic_1164.all; entity dumb_inv is port( a: in std_logic; y : out std_logic ); end dumb_inv; architecture comb of dumb_inv is process (a) -- invoked when signal a changes if a = 1 then y <= 0 ; else y <= 1 ; end process; end comb;
43 A 4-to-1 mux in the procedural style library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity pmultiplexer_4_1 is port(in0, in1, in2, in3 : in unsigned(15 downto 0); s : in unsigned(1 downto 0); z : out unsigned(15 downto 0)); end pmultiplexer_4_1; architecture comb of pmultiplexer_4_1 is process (in0, in1, in2, in3, s) z <= (others => X ); -- default if s = "00" then z <= in0; -- assignment overrides default elsif s = "01" then z <= in1; elsif s = "10" then z <= in2; elsif s = "11" then z <= in3; end process; end comb;
44 A 4-to-1 mux using case library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity cmultiplexer_4_1 is port(in0, in1, in2, in3 : in unsigned(15 downto 0); s : in unsigned(1 downto 0); z : out unsigned(15 downto 0)); end cmultiplexer_4_1; architecture comb of cmultiplexer_4_1 is process (in0, in1, in2, in3, s) case s is when "00" => z <= in0; when "01" => z <= in1; when "10" => z <= in2; when "11" => z <= in3; when others => z <= (others => X ); end case; end process; end comb;
45 An Address Decoder library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity adecoder is port(a : in unsigned(15 downto 0); ram, rom, video, io : out std_logic); end adecoder; architecture proc of adecoder is process (a) ram <= 0 ; rom <= 0 ; video <= 0 ; io <= 0 ; if a(15) = 0 then ram <= 1 ; FFF elsif a(14 downto 13) = "00" then video <= 1 ; FFF elsif a(14 downto 12) = "101" then io <= 1 ; -- D000-DFFF elsif a(14 downto 13) = "11" then rom <= 1 ; -- E000-FFFF end process; end proc;
46 Summary of Procedural Modeling null signal <= expr ; variable := expr ; if expr then stmts (elsif expr then stmts) (else stmts)? case expr is (when choices => stmts) end case; Note: when...else and with...select not allowed
47 Sequential Logic
48 Basic D Flip-Flop library ieee; use ieee.std_logic_1164.all; entity flipflop is port (Clk, D : in std_logic; Q : out std_logic); end flipflop; architecture imp of flipflop is process (Clk) -- Sensitive only to Clk if rising_edge(clk) then -- 0->1 transition Q <= D; end process; D Q end imp;
49 Flip-Flop with Latch Enable library ieee; use ieee.std_logic_1164.all; entity flipflop_enable is port (Clk, D, EN : in std_logic; Q : out std_logic); end flipflop_enable; architecture imp of flipflop_enable is process (Clk) if rising_edge(clk) then if EN = 1 then Q <= D; end process; D EN Clk 0 1 D Q Q end imp;
50 Flip-Flop with Synchronous Reset library ieee; use ieee.std_logic_1164.all; entity flipflop_reset is port (Clk, Reset, D : in std_logic; Q : out std_logic); end flipflop_reset; architecture imp of flipflop_reset is process (Clk) if rising_edge(clk) then if Reset = 1 then Q <= 0 ; else Q <= D; end process; end imp;
51 Four-bit binary counter library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity counter is port(clk, Reset : in std_logic; Q : out unsigned(3 downto 0)); end counter; architecture imp of counter is signal count : unsigned(3 downto 0); process (Clk) if rising_edge(clk) then if Reset = 1 then count <= (others => 0 ); else count <= count + 1; end process; Q <= count; -- copy count to output end imp;
52 Eight-bit serial in/out shift register library ieee; use ieee.std_logic_1164.all; entity shifter is port ( Clk, SI : in std_logic; SO : out std_logic); end shifter; architecture impl of shifter is signal tmp : std_logic_vector(7 downto 0); process (Clk) if rising_edge(clk) then tmp <= tmp(6 downto 0) & SI; -- & is concatenation end process; SO <= tmp(7); -- Copy to output end impl;
53 Synchronous RAM library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity ram_32_4 is port ( Clk, WE : in std_logic; -- Clock and write enable addr : in unsigned(4 downto 0); di : in unsigned(3 downto 0); -- Data in do : out unsigned(3 downto 0)); -- Data out end ram_32_4; architecture imp of ram_32_4 is type ram_type is array(0 to 31) of unsigned(3 downto 0); signal RAM : ram_type; process (Clk) if rising_edge(clk) then if we = 1 then RAM(TO_INTEGER(addr)) <= di; do <= di; -- write-through else do <= RAM(TO_INTEGER(addr)); end process; end imp;
54 A small ROM library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity rom_32_4 is port (Clk, en : in std_logic; addr : in unsigned(3 downto 0); data : out unsigned(3 downto 0)); end rom_32_4; architecture imp of rom_32_4 is type rom_type is array (0 to 15) of unsigned(3 downto 0); constant ROM : rom_type := (X"1", X"2", X"3", X"4", X"5", X"6", X"7", X"8", X"9", X"A", X"B", X"C", X"D", X"E", X"F", X"1"); process (Clk) if rising_edge(clk) then if en = 1 then data <= ROM(TO_INTEGER(addr)); end process; end imp;
55 Variables and Signals library ieee; use ieee.std_logic_1164.all; entity twoshiftreg is port(clk, si1, si2 : in std_logic; so1, so2 : out std_logic); end twoshiftreg; architecture imp of twoshiftreg is signal sr1 : std_logic_vector(1 downto 0); -- visible globally process (clk) variable sr2 : std_logic_vector(1 downto 0); -- process-only if rising_edge(clk) then sr1(1) <= si1; -- Effect seen only after next clk sr1(0) <= sr1(1); -- Any order works so1 <= sr1(0); so2 <= sr2(0); sr2(0) := sr2(1); -- Effect seen immediately sr2(1) := si2; -- Must be in this order end process; end imp;
56 Variables vs. Signals Property Variables Signals Scope Local to process Visible throughout architecture Assignment Felt immediately (e.g., in next statement) Only visible after clock rises (i.e., process terminates) Lesson: use variables to hold temporary results and state to be hidden within a process. Otherwise, use signals.
57 Constants: A VGA sync generator library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity sync_gen is port (clk : in std_logic; hs, vs : out std_logic); end sync_gen; architecture rtl of sync_gen is constant HTOTAL : integer := 800; constant HSYNC : integer := 96; constant VTOTAL : integer := 525; constant VSYNC : integer := 2; signal hcount, vcount : unsigned(9 downto 0); process (clk) if rising_edge(clk) then if hcount = HTOTAL - 1 then hcount <= (others => 0 ); hs <= 1 ; if vcount = VTOTAL - 1 then vcount <= (others => 0 ); vs <= 1 ; else if vcount = VSYNC then vs <= 0 ; vcount <= vcount + 1; else if hcount = HSYNC then hs <= 0 ; hcount <= hcount + 1;
58 FSMs
59 Moore and Mealy Machines Inputs Next State Logic Next State CLK Current State Output Logic Outputs The Moore Form: Outputs are a function of only the current state.
60 Moore and Mealy Machines Inputs Next State Logic Next State CLK Current State Output Logic Outputs The Mealy Form: Outputs may be a function of both the current state and the inputs. A mnemonic: Moore machines often have more states.
61 Coding Moore State Machines library ieee; use ieee.std_logic_1164.all; entity threecount is port(clk, reset, count : in std_logic; at0 : out std_logic); end threecount; architecture moore of threecount is type states is (ZERO, ONE, TWO); -- States encoded automatically process (clk) variable state : states; if rising_edge(clk) then if reset = 1 then state := ZERO; else case state is when ZERO => if count = 1 then state := ONE; when ONE => if count = 1 then state := TWO; when TWO => if count = 1 then state := ZERO; end case; if state = ZERO then at0 <= 1 ; else at0 <= 0 ; end process; end moore;
62 Mealy Machines are the Most General Inputs Outputs Current State C L CLK Next State Another, equivalent way of drawing Mealy Machines This is exactly the synchronous digital logic paradigm
63 Coding Mealy State Machines architecture mealy of... is type states is (IDLE, STATE1,...); signal state, next_state : states; process (clk) -- Sequential process if rising_edge(clk) then state <= next_state; end process; process (reset, state, i1, i2,... ) -- Combinational process next_state <= state; -- Default: hold if reset = 1 then next_state <= IDLE; else case state is when IDLE => if i1 = 1 then next_state <= STATE1; when STATE1 =>
64 FSM Example: A Traffic Light Controller This controls a traffic C light at the intersection of a busy highway and a farm road. Normally, the highway light is green but if a sensor C detects a car on the farm road, the highway light turns yellow then red. The farm road light then turns green until there are no cars or after a long timeout. Then, the farm road light turns yellow then red, and the highway light returns to green. The inputs to the machine are the car sensor, a short timeout signal, and a long timeout signal. The outputs are a timer start signal and the colors of the highway and farm road lights. Source: Mead and Conway, Introduction to VLSI Systems, 1980, p. 85.
65 State Transition Diagram for the TLC HG H : G F : R Inputs: C: Car sensor S: Short Timeout L: Long Timeout Outputs: T: Timer Reset H: Highway color F: Farm road color
66 State Transition Diagram for the TLC C + L/T HG H : G F : R CL/T HY H : Y F : R Inputs: C: Car sensor S: Short Timeout L: Long Timeout Outputs: T: Timer Reset H: Highway color F: Farm road color
67 State Transition Diagram for the TLC C + L/T HG H : G F : R CL/T HY H : Y F : R S/T S/T S/T FY H : R F : Y C + L/T S/T Inputs: C: Car sensor S: Short Timeout L: Long Timeout FG H : R F : G C L/T Outputs: T: Timer Reset H: Highway color F: Farm road color
68 Traffic Light Controller in VHDL library ieee; use ieee.std_logic_1164.all; entity tlc is port (clk, reset : in std_logic; cars, short, long : in std_logic; highway_yellow, highway_red : out std_logic; farm_yellow, farm_red : out std_logic; start_timer : out std_logic); end tlc; architecture imp of tlc is type states is (HG, HY, FY, FG); signal state, next_state : states; process (clk) -- Sequential process if rising_edge(clk) then state <= next_state; end process;
69 TLC in VHDL, continued process (state, reset, cars, short, long) if reset = 1 then start_timer <= 1 ; next_state <= HG; else case state is when HG => highway_yellow <= 0 ; highway_red <= 0 ; farm_yellow <= 0 ; farm_red <= 1 ; if cars = 1 and long = 1 then start_timer <= 1 ; next_state <= HY; else start_timer <= 0 ; next_state <= HG; when HY => highway_yellow <= 1 ; highway_red <= 0 ; farm_yellow <= 0 ; farm_red <= 1 ; if short = 1 then start_timer <= 1 ; next_state <= FG; else start_timer <= 0 ; next_state <= HY;
70 TLC in VHDL, concluded when FG => highway_yellow <= 0 ; highway_red <= 1 ; farm_yellow <= 0 ; farm_red <= 0 ; if cars = 0 or long = 1 then start_timer <= 1 ; next_state <= FY; else start_timer <= 0 ; next_state <= FG; when FY => highway_yellow <= 0 ; highway_red <= 1 ; farm_yellow <= 1 ; farm_red <= 0 ; if short = 1 then start_timer <= 1 ; next_state <= HG; end case; end process; end imp; else start_timer <= 0 ; next_state <= FY;
71 Summary of the Three Modeling Styles
72 Three Modeling Styles: Dataflow (1) Combinational logic described by expressions -- Simple case a <= x and y; -- When...else selector b <= 1 when x = y else 0 ; --- With..select selector with x select c <= 1 when 0, 0 when 1, X when others;
73 Procedural Combinational (2) Combinational logic described by statements and expressions process (x, y) -- Should be sensitive to every signal it reads a <= x and y; if x = y then b <= 1 ; else b <= 0 ; case x of 0 => c <= 1 ; 1 => c <= 0 ; others => c <= X ; end case; end process;
74 Three Styles: Procedural Sequential (3) Combinational logic driving flip-flops described by statements and expressions. process (clk) -- Sensitive only to the clock if rising_edge(clk) then -- Always check for rising edge a <= x and y; if x = y then b <= 1 ; else b <= 0 ; case x of 0 => c <= 1 ; 1 => c <= 0 ; others => c <= X ; end case; end process;
75 Ten Commandments of VHDL
76 I: Thou Shalt Design Before Coding Know the structure of what you are designing first. Draw a block diagram of the datapath Understand the timing (draw diagrams) Draw bubble-and-arc diagrams for FSMs Only once you have a design should you start coding in VHDL VHDL is only a way to ask for component
77 II: Thou Shalt be Synchronous One global clock Flip-flops generate inputs to combinational logic, which computes inputs to flip-flops Exactly one value per signal per clock cycle Do not generate asynchronous reset signals; only use them if they are external Edge-triggered flip-flops only. Do not use level-sensitive logic. Do not generate clock signals. Use multiplexers to create load enable signals on flip-flops.
78 III: Thou Shalt Be Sensitive Combinational processes: list all process inputs process (state, long) if reset = 1 then next_state <= HG; start_timer <= 1 ; else case state is when HG => farm_yellow <= 0 ; if cars = 1 and long = 1 then next_state <= HY; else next_state <= HG; when HY => farm_yellow <= 0 ; if short = 1 then next_state <= FG; else next_state <= HY; process (state, reset, cars, short, long) if reset = 1 then next_state <= HG; start_timer <= 1 ; else case state is when HG => farm_yellow <= 0 ; if cars = 1 and long = 1 then next_state <= HY; else next_state <= HG; when HY => farm_yellow <= 0 ; if short = 1 then next_state <= FG; else next_state <= HY;
79 III: Thou Shalt Be Sensitive Sequential processes: always include the clock. Include reset if asynchronous, and nothing else. process (Clk, D) if rising_edge(clk) then Q <= D; end process; process (Clk, D) if reset = 1 then Q <= 0 ; else if rising_edge(clk) then Q <= D; end process; process (Clk) if rising_edge(clk) then Q <= D; end process; process (Clk, reset) if reset = 1 then Q <= 0 ; else if rising_edge(clk) then Q <= D; end process;
80 IV: Thou Shalt Assign All Outputs Synthesis infers level-sensitive latches if sometimes you do not assign an output. process (state, input) case state is when S1 => if input = 1 then output <= 0 ; when S2 => output <= 1 ; end case; end process; process (state, input) case state is when S1 => if input = 1 then output <= 0 ; else output <= 1 ; when S2 => output <= 1 ; end case; end process;
81 Default values are convenient -- OK process (state, input) case state is when S1 => if input = 1 then output <= 0 ; else output <= 1 ; when S2 => output <= 1 ; end case; end process; -- Better process (state, input) output <= 1 ; case state is when S1 => if input = 1 then output <= 0 ; end case; end process;
82 V: Thou Shalt Enumerate States Better to use an enumeration to encode states: type states is (START, RUN, IDLE, ZAPHOD); signal current, next : states; process (current) case current is when START =>... when RUN =>... when IDLE =>... end case; end process; Running this produces a helpful error: Compiling vhdl file "/home/cristi/cs4840/lab4/main.v Entity <system> compiled. ERROR:HDLParsers:813 - "/home/cristi/cs4840/lab4/mai Enumerated value zaphod is missing in case. -->
83 VI: (There is no rule six)
84 VII: Thou Shalt Avoid Async Only use asynchronous reset when there is one global signal from outside. -- OK for external Reset process (Clk, Reset) if Reset = 1 then Q <= 0 ; else if rising_edge(clk) then Q <= D; end process; -- Better process (Clk) if rising_edge(clk) then if Reset = 1 then Q <= 0 ; else Q <= D; end process; Never generate your own asynchronous reset. Generating a synchronous reset is fine
85 VIII: Thou Shalt Have One Version Never assume signals from the test bench that are not there on the board It is hard enough to make simulation match the design; do not make it any harder If you must slow down hardware, carefully generate a slower clock and only use that clock globally.
86 IX: Thou Shalt Not Test For X Or Z architecture behv of ALU is process (A,B,Sel) case Sel is when "00" => Res <= A + B; when "01" => Res <= A + (not B) + 1; when "1X" => Res <= A and B; when "1Z" => Res <= A or B; when others => Res <= "XX"; end case; end process; end behv; architecture behv of ALU is process(a,b,sel) case Sel is when "00" => Res <= A + B; when "01" => Res <= A + (not B) + 1; when "10" => Res <= A and B; when "11" => Res <= A or B; when others => Res <= "XX"; end case; end process; end behv; This is legal VHDL, but the synthesized circuit won t behave like you expect.
87 X: Thou Shalt Not Specify Delays The wait statement can delay for a certain amount of time, e.g., wait 10ns; Only use it in test benches that are not meant to become hardware Do not use them in the design of your hardware
88 Pitfalls: Boolean vs. Std_logic Don t assign Boolean to std_logic. signal a : std_logic; signal b : unsigned(7 downto 0); a <= b = x"7e"; -- BAD: result is Boolean, not std_logic a <= 1 when b = x"7e" else 0 ; -- OK Don t test std_logic in a Boolean context. signal a, b, foo : std_logic; if a then -- BAD: A is not Boolean foo <= 1 ; b <= 0 when a else 1 ; -- BAD: a is not Boolean if a = 1 then -- OK foo <= 1 ; b <= 0 when a = 1 else 0 ; -- OK
89 Pitfalls: Inferring a Latch In a combinational process, make sure all output signals are always assigned. process (x, y) if x = 1 then y <= 0 ; -- BAD: y not assigned when x = 0, synthesis infers a latch end process; process (x, y) y <= 1 ; -- OK: y is always assigned if x = 1 then y <= 0 ; end process
90 Pitfalls: Reading Output Port library ieee; use ieee.std_logic_1164.all; entity dont_read_output is port ( a : in std_logic; x, y : out std_logic ); end dont_read_output; architecture BAD of dont_read_output is x <= not a; y <= not x; -- Error: can t read an output port end BAD; architecture OK of dont_read_output is signal x_sig : std_logic; x_sig <= not a; x <= x_sig; -- x_sig just another name for x y <= not x_sig; -- OK end OK;
91 Pitfalls: Complex Port Map Args library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity bad_port_map is end bad_port_map; architecture BAD of bad_port_map is component bar port (x : in unsigned(5 downto 0) ); end component; signal a : unsigned(3 downto 0); mybar : bar port map ( x => "000" & a); -- BAD end BAD; architecture OK of bad_port_map is component bar port (x : in unsigned(5 downto 0) ); end component; signal a : unsigned(3 downto 0); signal aa : unsigned(5 downto 0); aa <= "000" & a; mybar : bar port map ( x => aa ); -- OK end OK;
92 Pitfalls: Combinational Loops You never really need them. Drive every signal from exactly one process or concurrent assignment. Don t build SR latches. Use D flip-flops instead.
93 Pitfalls: Clock Gating Dangerous, difficult to get right. Use a single, global clock and latch enables to perform the same function.
94 Pitfalls: Multiple Clock Domains If you must, vary the phase and drive clocks directly from flip-flops.
95 Writing Testbenches
96 Testbenches One of VHDL s key points: can describe hardware and environment together. -- Explicit delays are allowed clk <= not clk after 50 ns; process reset <= 0 ; wait for 10 ns; -- Explicit delay reset <= 1 ; wait for a = 1 ; -- Delay for an event assert b = 1 report "b did not rise" severity failure; assert c = 1 report "c=0" severity warning; -- or error or note wait for 50 ns; -- Delay for some time wait; -- Halt this process end process;
97 Testbench Methodology Always put testbench in a separate.vhd file since it cannot be synthesized. Instantiate block under test and apply desired inputs (clocks, other stimulus) Use assert to check conditions Try to emulate hardware environment as closely as possible (no special inputs, etc.)
98 A Testbench library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity tlc_tb is -- A testbench usually has no ports end tlc_tb; architecture tb of tlc_tb is signal clk : std_logic := 0 ; -- Must initialize! -- One signal per port is typical signal reset, cars, short, long : std_logic; signal farm_red, start_timer : std_logic; clk <= not clk after ns; MHz
99 A testbench continued -- Apply stimulus and check the results process cars <= 0 ; short <= 0 ; long <= 0 ; reset <= 1 ; wait for 100 ns; assert start_timer = 1 report "No timer" severity error; reset <= 0 ; wait for 100 ns; assert farm_red = 1 report "Farm not red" severity error; wait; end process; -- Instantiate the Unit Under Test uut : entity work.tlc port map ( clk => clk, reset => reset, cars => cars, short => short, long => long, farm_red => farm_red, start_timer => start_timer); end tb;
VHDL GUIDELINES FOR SYNTHESIS
VHDL GUIDELINES FOR SYNTHESIS Claudio Talarico For internal use only 1/19 BASICS VHDL VHDL (Very high speed integrated circuit Hardware Description Language) is a hardware description language that allows
ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)
ECE 3401 Lecture 7 Concurrent Statements & Sequential Statements (Process) Concurrent Statements VHDL provides four different types of concurrent statements namely: Signal Assignment Statement Simple Assignment
if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;
if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z
Digital Design with VHDL
Digital Design with VHDL CSE 560M Lecture 5 Shakir James Shakir James 1 Plan for Today Announcement Commentary due Wednesday HW1 assigned today. Begin immediately! Questions VHDL help session Assignment
Digital Systems Design. VGA Video Display Generation
Digital Systems Design Video Signal Generation for the Altera DE Board Dr. D. J. Jackson Lecture 12-1 VGA Video Display Generation A VGA signal contains 5 active signals Two TTL compatible signals for
Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng
Digital Logic Design Basics Combinational Circuits Sequential Circuits Pu-Jen Cheng Adapted from the slides prepared by S. Dandamudi for the book, Fundamentals of Computer Organization and Design. Introduction
RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition
RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition A Tutorial Approach James O. Hamblen Georgia Institute of Technology Michael D. Furman Georgia Institute of Technology KLUWER ACADEMIC PUBLISHERS Boston
VHDL Test Bench Tutorial
University of Pennsylvania Department of Electrical and Systems Engineering ESE171 - Digital Design Laboratory VHDL Test Bench Tutorial Purpose The goal of this tutorial is to demonstrate how to automate
ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. http://www.ecs.umass.edu/ece/ece232/ Basic Verilog
ECE232: Hardware Organization and Design Part 3: Verilog Tutorial http://www.ecs.umass.edu/ece/ece232/ Basic Verilog module ();
VGA video signal generation
A VGA display controller VGA video signal generation A VGA video signal contains 5 active signals: horizontal sync: digital signal, used for synchronisation of the video vertical sync: digital signal,
Digital Electronics Detailed Outline
Digital Electronics Detailed Outline Unit 1: Fundamentals of Analog and Digital Electronics (32 Total Days) Lesson 1.1: Foundations and the Board Game Counter (9 days) 1. Safety is an important concept
More Verilog. 8-bit Register with Synchronous Reset. Shift Register Example. N-bit Register with Asynchronous Reset.
More Verilog 8-bit Register with Synchronous Reset module reg8 (reset, CLK, D, Q); input reset; input [7:0] D; output [7:0] Q; reg [7:0] Q; if (reset) Q = 0; else Q = D; module // reg8 Verilog - 1 Verilog
Memory Elements. Combinational logic cannot remember
Memory Elements Combinational logic cannot remember Output logic values are function of inputs only Feedback is needed to be able to remember a logic value Memory elements are needed in most digital logic
CHAPTER 3 Boolean Algebra and Digital Logic
CHAPTER 3 Boolean Algebra and Digital Logic 3.1 Introduction 121 3.2 Boolean Algebra 122 3.2.1 Boolean Expressions 123 3.2.2 Boolean Identities 124 3.2.3 Simplification of Boolean Expressions 126 3.2.4
CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni
CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE Ioan Lemeni Computer and Communication Engineering Department Faculty of Automation, Computers and Electronics University of Craiova 13, A.I. Cuza, Craiova,
EE360: Digital Design I Course Syllabus
: Course Syllabus Dr. Mohammad H. Awedh Fall 2008 Course Description This course introduces students to the basic concepts of digital systems, including analysis and design. Both combinational and sequential
12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr
2..,.,.. Flip-Flops :, Flip-Flops, Flip Flop. ( MOD)... -8 8, 7 ( ).. n Flip-Flops. n Flip-Flops : 2 n. 2 n, Modulo. (-5) -4 ( -), (-) - ( -).. / A A A 2 3 4 5 MOD-5 6 MOD-6 7 MOD-7 8 9 / A A A 2 3 4 5
Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: 03-4227151 ext:34534 Email: [email protected]. Sequential Circuit
Modeling Sequential Elements with Verilog Prof. Chien-Nan Liu TEL: 03-4227151 ext:34534 Email: [email protected] 4-1 Sequential Circuit Outputs are functions of inputs and present states of storage elements
Quartus II Introduction for VHDL Users
Quartus II Introduction for VHDL Users This tutorial presents an introduction to the Quartus II software. It gives a general overview of a typical CAD flow for designing circuits that are implemented by
Digital Electronics Part I Combinational and Sequential Logic. Dr. I. J. Wassell
Digital Electronics Part I Combinational and Sequential Logic Dr. I. J. Wassell Introduction Aims To familiarise students with Combinational logic circuits Sequential logic circuits How digital logic gates
Digital Design and Synthesis INTRODUCTION
Digital Design and Synthesis INTRODUCTION The advances in digital design owe its progress to 3 factors. First the acceleration at which the CMOS technology has advanced in last few decades and the way
Life Cycle of a Memory Request. Ring Example: 2 requests for lock 17
Life Cycle of a Memory Request (1) Use AQR or AQW to place address in AQ (2) If A[31]==0, check for hit in DCache Ring (3) Read Hit: place cache word in RQ; Write Hit: replace cache word with WQ RDDest/RDreturn
A Verilog HDL Test Bench Primer Application Note
A Verilog HDL Test Bench Primer Application Note Table of Contents Introduction...1 Overview...1 The Device Under Test (D.U.T.)...1 The Test Bench...1 Instantiations...2 Figure 1- DUT Instantiation...2
Computer organization
Computer organization Computer design an application of digital logic design procedures Computer = processing unit + memory system Processing unit = control + datapath Control = finite state machine inputs
Sistemas Digitais I LESI - 2º ano
Sistemas Digitais I LESI - 2º ano Lesson 6 - Combinational Design Practices Prof. João Miguel Fernandes ([email protected]) Dept. Informática UNIVERSIDADE DO MINHO ESCOLA DE ENGENHARIA - PLDs (1) - The
1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.
File: chap04, Chapter 04 1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1. 2. True or False? A gate is a device that accepts a single input signal and produces one
Step : Create Dependency Graph for Data Path Step b: 8-way Addition? So, the data operations are: 8 multiplications one 8-way addition Balanced binary
RTL Design RTL Overview Gate-level design is now rare! design automation is necessary to manage the complexity of modern circuits only library designers use gates automated RTL synthesis is now almost
State Machines in VHDL
State Machines in VHDL Implementing state machines in VHDL is fun and easy provided you stick to some fairly well established forms. These styles for state machine coding given here is not intended to
Flip-Flops, Registers, Counters, and a Simple Processor
June 8, 22 5:56 vra235_ch7 Sheet number Page number 349 black chapter 7 Flip-Flops, Registers, Counters, and a Simple Processor 7. Ng f3, h7 h6 349 June 8, 22 5:56 vra235_ch7 Sheet number 2 Page number
The Designer's Guide to VHDL
The Designer's Guide to VHDL Third Edition Peter J. Ashenden EDA CONSULTANT, ASHENDEN DESIGNS PTY. LTD. ADJUNCT ASSOCIATE PROFESSOR, ADELAIDE UNIVERSITY AMSTERDAM BOSTON HEIDELBERG LONDON m^^ yj 1 ' NEW
5 Combinatorial Components. 5.0 Full adder. Full subtractor
5 Combatorial Components Use for data transformation, manipulation, terconnection, and for control: arithmetic operations - addition, subtraction, multiplication and division. logic operations - AND, OR,
Modeling Latches and Flip-flops
Lab Workbook Introduction Sequential circuits are digital circuits in which the output depends not only on the present input (like combinatorial circuits), but also on the past sequence of inputs. In effect,
Register File, Finite State Machines & Hardware Control Language
Register File, Finite State Machines & Hardware Control Language Avin R. Lebeck Some slides based on those developed by Gershon Kedem, and by Randy Bryant and ave O Hallaron Compsci 04 Administrivia Homework
Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language
Chapter 4 Register Transfer and Microoperations Section 4.1 Register Transfer Language Digital systems are composed of modules that are constructed from digital components, such as registers, decoders,
Introduction. Jim Duckworth ECE Department, WPI. VHDL Short Course - Module 1
VHDL Short Course Module 1 Introduction Jim Duckworth ECE Department, WPI Jim Duckworth, WPI 1 Topics Background to VHDL Introduction to language Programmable Logic Devices CPLDs and FPGAs FPGA architecture
Finite State Machine Design and VHDL Coding Techniques
Finite State Machine Design and VHDL Coding Techniques Iuliana CHIUCHISAN, Alin Dan POTORAC, Adrian GRAUR "Stefan cel Mare" University of Suceava str.universitatii nr.13, RO-720229 Suceava [email protected],
In this example the length of the vector is determined by D length and used for the index variable.
Loops Loop statements are a catagory of control structures that allow you to specify repeating sequences of behavior in a circuit. There are three primary types of loops in VHDL: for loops, while loops,
Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)
Dr. Greg Tumbush, [email protected] Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts) Objective The objective of lab assignments 5 through 9 are to systematically design and implement
Floating point package user s guide By David Bishop ([email protected])
Floating point package user s guide By David Bishop ([email protected]) Floating-point numbers are the favorites of software people, and the least favorite of hardware people. The reason for this is because
Designing Digital Circuits a modern approach. Jonathan Turner
Designing Digital Circuits a modern approach Jonathan Turner 2 Contents I First Half 5 1 Introduction to Designing Digital Circuits 7 1.1 Getting Started.......................... 7 1.2 Gates and Flip
The 104 Duke_ACC Machine
The 104 Duke_ACC Machine The goal of the next two lessons is to design and simulate a simple accumulator-based processor. The specifications for this processor and some of the QuartusII design components
LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER
LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER OBJECTIVES 1. Learn the basic elements of VHDL that are implemented in Warp. 2. Build a simple application using VHDL and
Decimal Number (base 10) Binary Number (base 2)
LECTURE 5. BINARY COUNTER Before starting with counters there is some vital information that needs to be understood. The most important is the fact that since the outputs of a digital chip can only be
Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems
Harris Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems David Harris Harvey Mudd College [email protected] Based on EE271 developed by Mark Horowitz, Stanford University MAH
Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )
Sequential Logic (Materials taken from: Principles of Computer Hardware by Alan Clements ) Sequential vs. Combinational Circuits Combinatorial circuits: their outputs are computed entirely from their present
Using Xilinx ISE for VHDL Based Design
ECE 561 Project 4-1 - Using Xilinx ISE for VHDL Based Design In this project you will learn to create a design module from VHDL code. With Xilinx ISE, you can easily create modules from VHDL code using
ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path
ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path Project Summary This project involves the schematic and layout design of an 8-bit microprocessor data
FINITE STATE MACHINE: PRINCIPLE AND PRACTICE
CHAPTER 10 FINITE STATE MACHINE: PRINCIPLE AND PRACTICE A finite state machine (FSM) is a sequential circuit with random next-state logic. Unlike the regular sequential circuit discussed in Chapters 8
A New Paradigm for Synchronous State Machine Design in Verilog
A New Paradigm for Synchronous State Machine Design in Verilog Randy Nuss Copyright 1999 Idea Consulting Introduction Synchronous State Machines are one of the most common building blocks in modern digital
Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview
Technical Note TN-29-06: NAND Flash Controller on Spartan-3 Overview Micron NAND Flash Controller via Xilinx Spartan -3 FPGA Overview As mobile product capabilities continue to expand, so does the demand
150127-Microprocessor & Assembly Language
Chapter 3 Z80 Microprocessor Architecture The Z 80 is one of the most talented 8 bit microprocessors, and many microprocessor-based systems are designed around the Z80. The Z80 microprocessor needs an
EC313 - VHDL State Machine Example
EC313 - VHDL State Machine Example One of the best ways to learn how to code is seeing a working example. Below is an example of a Roulette Table Wheel. Essentially Roulette is a game that selects a random
Discrete event modeling: VHDL
12 Discrete event modeling: VHDL Peter Marwedel Informatik 12 Univ. Dortmund Germany Models of computation VHDL as a prominent example of discrete event modeling: Communication/ Computation FSM Data flow
Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:
PS-2 Mouse: The Protocol: For out mini project we designed a serial port transmitter receiver, which uses the Baud rate protocol. The PS-2 port is similar to the serial port (performs the function of transmitting
Asynchronous & Synchronous Reset Design Techniques - Part Deux
Clifford E. Cummings Don Mills Steve Golson Sunburst Design, Inc. LCDM Engineering Trilobyte Systems [email protected] [email protected] [email protected] ABSTRACT This paper will investigate
Lecture 7: Clocking of VLSI Systems
Lecture 7: Clocking of VLSI Systems MAH, AEN EE271 Lecture 7 1 Overview Reading Wolf 5.3 Two-Phase Clocking (good description) W&E 5.5.1, 5.5.2, 5.5.3, 5.5.4, 5.5.9, 5.5.10 - Clocking Note: The analysis
Combinational Logic Design Process
Combinational Logic Design Process Create truth table from specification Generate K-maps & obtain logic equations Draw logic diagram (sharing common gates) Simulate circuit for design verification Debug
Modeling Registers and Counters
Lab Workbook Introduction When several flip-flops are grouped together, with a common clock, to hold related information the resulting circuit is called a register. Just like flip-flops, registers may
Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit
1 Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENT OF FOR THE DEGREE IN Bachelor of Technology In Electronics and Communication
Memory Systems. Static Random Access Memory (SRAM) Cell
Memory Systems This chapter begins the discussion of memory systems from the implementation of a single bit. The architecture of memory chips is then constructed using arrays of bit implementations coupled
DEPARTMENT OF INFORMATION TECHNLOGY
DRONACHARYA GROUP OF INSTITUTIONS, GREATER NOIDA Affiliated to Mahamaya Technical University, Noida Approved by AICTE DEPARTMENT OF INFORMATION TECHNLOGY Lab Manual for Computer Organization Lab ECS-453
Understanding Logic Design
Understanding Logic Design ppendix of your Textbook does not have the needed background information. This document supplements it. When you write add DD R0, R1, R2, you imagine something like this: R1
ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies
ETEC 2301 Programmable Logic Devices Chapter 10 Counters Shawnee State University Department of Industrial and Engineering Technologies Copyright 2007 by Janna B. Gallaher Asynchronous Counter Operation
Chapter 5. Sequential Logic
Chapter 5 Sequential Logic Sequential Circuits (/2) Combinational circuits: a. contain no memory elements b. the outputs depends on the current inputs Sequential circuits: a feedback path outputs depends
A CPLD VHDL Introduction
Application Note: CPLD R XAPP105 (v2.0) August 30, 2001 Summary This introduction covers the fundamentals of VHDL as applied to Complex Programmable Logic Devices (CPLDs). Specifically included are those
Finite State Machine. RTL Hardware Design by P. Chu. Chapter 10 1
Finite State Machine Chapter 10 1 Outline 1. Overview 2. FSM representation 3. Timing and performance of an FSM 4. Moore machine versus Mealy machine 5. VHDL description of FSMs 6. State assignment 7.
Combinational Logic Design
Chapter 4 Combinational Logic Design The foundations for the design of digital logic circuits were established in the preceding chapters. The elements of Boolean algebra (two-element switching algebra
EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad
A. M. Niknejad University of California, Berkeley EE 100 / 42 Lecture 24 p. 1/20 EE 42/100 Lecture 24: Latches and Flip Flops ELECTRONICS Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad University of California,
VHDL Reference Manual
VHDL Reference Manual 096-0400-003 March 1997 Synario Design Automation, a division of Data I/O, has made every attempt to ensure that the information in this document is accurate and complete. Synario
Combinational-Circuit Building Blocks
May 9, 24 :4 vra6857_ch6 Sheet number Page number 35 black chapter 6 Combinational-Circuit Building Blocks Chapter Objectives In this chapter you will learn about: Commonly used combinational subcircuits
Verification & Design Techniques Used in a Graduate Level VHDL Course
Verification & Design Techniques Used in a Graduate Level VHDL Course Prof. Swati Agrawal, BE, MS (SUNY, Buffalo, NY USA) 1 Associate Professor, Department of Electronics & Telecommunication, Bhilai Institute
University of St. Thomas ENGR 230 ---- Digital Design 4 Credit Course Monday, Wednesday, Friday from 1:35 p.m. to 2:40 p.m. Lecture: Room OWS LL54
Fall 2005 Instructor Texts University of St. Thomas ENGR 230 ---- Digital Design 4 Credit Course Monday, Wednesday, Friday from 1:35 p.m. to 2:40 p.m. Lecture: Room OWS LL54 Lab: Section 1: OSS LL14 Tuesday
Coding Guidelines for Datapath Synthesis
Coding Guidelines for Datapath Synthesis Reto Zimmermann Synopsys July 2005 Abstract This document summarizes two classes of RTL coding guidelines for the synthesis of datapaths: Guidelines that help achieve
Module 3: Floyd, Digital Fundamental
Module 3: Lecturer : Yongsheng Gao Room : Tech - 3.25 Email : [email protected] Structure : 6 lectures 1 Tutorial Assessment: 1 Laboratory (5%) 1 Test (20%) Textbook : Floyd, Digital Fundamental
DDS. 16-bit Direct Digital Synthesizer / Periodic waveform generator Rev. 1.4. Key Design Features. Block Diagram. Generic Parameters.
Key Design Features Block Diagram Synthesizable, technology independent VHDL IP Core 16-bit signed output samples 32-bit phase accumulator (tuning word) 32-bit phase shift feature Phase resolution of 2π/2
Let s put together a Manual Processor
Lecture 14 Let s put together a Manual Processor Hardware Lecture 14 Slide 1 The processor Inside every computer there is at least one processor which can take an instruction, some operands and produce
Introduction to Programmable Logic Devices. John Coughlan RAL Technology Department Detector & Electronics Division
Introduction to Programmable Logic Devices John Coughlan RAL Technology Department Detector & Electronics Division PPD Lectures Programmable Logic is Key Underlying Technology. First-Level and High-Level
PROGETTO DI SISTEMI ELETTRONICI DIGITALI. Digital Systems Design. Digital Circuits Advanced Topics
PROGETTO DI SISTEMI ELETTRONICI DIGITALI Digital Systems Design Digital Circuits Advanced Topics 1 Sequential circuit and metastability 2 Sequential circuit - FSM A Sequential circuit contains: Storage
Lenguaje VHDL. Diseño de sistemas digitales secuenciales
Lenguaje VHDL Diseño de sistemas digitales secuenciales Flip-Flop D 1 entity d_ff is clk: in std_logic; d: in std_logic; q: out std_logic 2 end d_ff; P3 P1 5 Q D Q Q(t+1) 0 0 0 0 1 0 1 0 1 1 1 1 architecture
Sequential Circuit Design
Sequential Circuit Design Lan-Da Van ( 倫 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall, 2009 [email protected] http://www.cs.nctu.edu.tw/~ldvan/ Outlines
Chapter 7 Memory and Programmable Logic
NCNU_2013_DD_7_1 Chapter 7 Memory and Programmable Logic 71I 7.1 Introduction ti 7.2 Random Access Memory 7.3 Memory Decoding 7.5 Read Only Memory 7.6 Programmable Logic Array 77P 7.7 Programmable Array
Hardware Implementation of the Stone Metamorphic Cipher
International Journal of Computer Science & Network Security VOL.10 No.8, 2010 Hardware Implementation of the Stone Metamorphic Cipher Rabie A. Mahmoud 1, Magdy Saeb 2 1. Department of Mathematics, Faculty
Engr354: Digital Logic Circuits
Engr354: igital Circuits Chapter 7 Sequential Elements r. Curtis Nelson Sequential Elements In this chapter you will learn about: circuits that can store information; Basic cells, latches, and flip-flops;
RUTGERS UNIVERSITY Department of Electrical and Computer Engineering 14:332:233 DIGITAL LOGIC DESIGN LABORATORY
RUTGERS UNIVERSITY Department of Electrical and Computer Engineering 14:332:233 DIGITAL LOGIC DESIGN LABORATORY Fall 2012 Contents 1 LABORATORY No 1 3 11 Equipment 3 12 Protoboard 4 13 The Input-Control/Output-Display
CSE140: Components and Design Techniques for Digital Systems
CSE4: Components and Design Techniques for Digital Systems Tajana Simunic Rosing What we covered thus far: Number representations Logic gates Boolean algebra Introduction to CMOS HW#2 due, HW#3 assigned
Memory unit. 2 k words. n bits per word
9- k address lines Read n data input lines Memory unit 2 k words n bits per word n data output lines 24 Pearson Education, Inc M Morris Mano & Charles R Kime 9-2 Memory address Binary Decimal Memory contents
Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann
Chapter 7 Registers & Register Transfers J. J. Shann J.J. Shann Chapter Overview 7- Registers and Load Enable 7-2 Register Transfers 7-3 Register Transfer Operations 7-4 A Note for VHDL and Verilog Users
Gates, Circuits, and Boolean Algebra
Gates, Circuits, and Boolean Algebra Computers and Electricity A gate is a device that performs a basic operation on electrical signals Gates are combined into circuits to perform more complicated tasks
(Refer Slide Time: 00:01:16 min)
Digital Computer Organization Prof. P. K. Biswas Department of Electronic & Electrical Communication Engineering Indian Institute of Technology, Kharagpur Lecture No. # 04 CPU Design: Tirning & Control
Getting the Most Out of Synthesis
Outline Getting the Most Out of Synthesis Dr. Paul D. Franzon 1. Timing Optimization Approaches 2. Area Optimization Approaches 3. Design Partitioning References 1. Smith and Franzon, Chapter 11 2. D.Smith,
(1) /30 (2) /30 (3) /40 TOTAL /100
Your Name: SI Number: UNIVERSITY OF CALIFORNIA AT BERKELEY BERKELEY AVIS IRVINE LOS ANGELES RIVERSIE SAN IEGO SAN FRANCISCO epartment of Electrical Engineering and Computer Sciences SANTA BARBARA SANTA
SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks
UNIVERSITY OF KERALA First Degree Programme in Computer Applications Model Question Paper Semester I Course Code- CP 1121 Introduction to Computer Science TIME : 3 hrs Maximum Mark: 80 SECTION A [Very
Chapter 13: Verification
Chapter 13: Verification Prof. Ming-Bo Lin Department of Electronic Engineering National Taiwan University of Science and Technology Digital System Designs and Practices Using Verilog HDL and FPGAs @ 2008-2010,
Lab 1: Introduction to Xilinx ISE Tutorial
Lab 1: Introduction to Xilinx ISE Tutorial This tutorial will introduce the reader to the Xilinx ISE software. Stepby-step instructions will be given to guide the reader through generating a project, creating
Table 1 below is a complete list of MPTH commands with descriptions. Table 1 : MPTH Commands. Command Name Code Setting Value Description
MPTH: Commands Table 1 below is a complete list of MPTH commands with descriptions. Note: Commands are three bytes long, Command Start Byte (default is 128), Command Code, Setting value. Table 1 : MPTH
RAM & ROM Based Digital Design. ECE 152A Winter 2012
RAM & ROM Based Digital Design ECE 152A Winter 212 Reading Assignment Brown and Vranesic 1 Digital System Design 1.1 Building Block Circuits 1.1.3 Static Random Access Memory (SRAM) 1.1.4 SRAM Blocks in
Registers & Counters
Objectives This section deals with some simple and useful sequential circuits. Its objectives are to: Introduce registers as multi-bit storage devices. Introduce counters by adding logic to registers implementing
Introduction to Xilinx System Generator Part II. Evan Everett and Michael Wu ELEC 433 - Spring 2013
Introduction to Xilinx System Generator Part II Evan Everett and Michael Wu ELEC 433 - Spring 2013 Outline Introduction to FPGAs and Xilinx System Generator System Generator basics Fixed point data representation
COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design
PH-315 COMINATIONAL and SEUENTIAL LOGIC CIRCUITS Hardware implementation and software design A La Rosa I PURPOSE: To familiarize with combinational and sequential logic circuits Combinational circuits
