A Data Stack CoreGen Discussion 12.1.

Slides:



Advertisements
Similar presentations
Quad 2-to-1 and Quad 4-to-1 Multiplexers Discussion D2.4 Example 7.
Advertisements

Arbitrary Waveform Discussion 5.5 Example 34.
Edge-Triggered D Flip-Flops Discussion D4.2 Example 26.
Multiplexer as a Universal Element Discussion D2.6 Example 9.
7-Segment Display: Spartan-3 board
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Top-level VHDL Designs
Generic Multiplexers: Parameters Discussion D2.5 Example 8.
Multiplication Discussion Multiplier Binary Multiplication 4 x 4 Multiplier.
Decoders and Encoders Lecture L4.2. Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders.
Logic Design Fundamentals - 3 Discussion D3.2. Logic Design Fundamentals - 3 Basic Gates Basic Combinational Circuits Basic Sequential Circuits.
Data Stack Lecture 8.2 A VHDL Forth Core for FPGAs: Sect. 3.
Integer Square Root.
Single-Cycle Instructions VHDL Tutorial R. E. Haskell and D. M. Hanna T5: VHDL ROM.
1 Comparators Discussion D A 1-Bit Comparator The variable Gout is 1 if x > y or if x = y and Gin = 1. The variable Eout is 1 if x = y and Gin =
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.
Structural VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T3: ALU Design.
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.
Multiplication Discussion Multiplier Binary Multiplication 4 x 4 Multiplier.
Introduction to VHDL Multiplexers. Introduction to VHDL VHDL is an acronym for VHSIC (Very High Speed Integrated Circuit) Hardware Description Language.
Lecture L6.2 VHDL Multiply Operator (*)
Lab 2 4-Bit Adder Digilent Spartan 3 Board Lecture L2.3.
4-to-1 Multiplexer: case Statement Discussion D2.3 Example 6.
FPGAs and VHDL Lecture L13.1 Sections 13.1 – 13.3.
Finite State Machines Discussion D8.1 Example 36.
7-Segment Displays Digilent Spartan 3 Board Discussion DS-4.2.
Introduction to VHDL Multiplexers Discussion D1.1.
Division Discussion D11.3. Division
7-Segment Displays VHDL Tutorial R. E. Haskell and D. M. Hanna T4: Xilinx LogiBLOX.
Registers Lab 5 Mano and Kime Sections 5-2, 5-3, 5-7.
Sequential Multiplication Lecture L6.4. Multiplication 13 x = 8Fh 1101 x
Shift Registers Discussion D5.2 Example Bit Shift Register qs(3) qs(2) qs(1) qs(0) if rising_edge(CLK) then for i in 0 to 2 loop s(i) := s(i+1);
Random-Access Memory Distributed and Block RAM Discussion D10.3 Example 41.
4-bit Shift Register. 2-bit Register Serial-in-serial-out Shift Register.
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
1 Part I: SYSTEM DESIGN. 2 Packages and Components Functions and Procedures Problem (Design & Implementation) Additional System Designs.
VHDL for Combinational Circuits. VHDL We Know Simple assignment statements –f
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
ECE 331 – Digital System Design Multiplexers and Demultiplexers (Lecture #13)
2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.
4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5.
Lecture 11 Xilinx FPGA Memories Part 2
Prime Numbers Lecture L6.1 Sieve of Eratosthenes.
Registers and Counters Discussion D8.1. Logic Design Fundamentals - 3 Registers Counters Shift Registers.
Combinational logic circuit
Main Project : Simple Processor Mini-Project : Vending Machine Memory
Part II A workshop by Dr. Junaid Ahmed Zubairi
Part III: SYSTEM DESIGN
Hardware Description Languages
Part IV: VHDL CODING.
Comparators Discussion DS-3.1.
Fast, Asynchronous SRAM
Mano and Kime Sections 7-6 – 7-8
مدار های ترکیبی دیکدر لامپ های هفت قسمتی یکی از دیکدر هایی که اغلب به کار برده می شود،دیکدر 4 به 7 برای تبدیل کد bcd به کد هفت بیتی برای لامپ های seven.
ECE-C 302 Lecture 15 Prawat Nagvajara
ECE 545 Lecture 17 RAM.
A Greatest Common Divisor (GCD) Processor
CPE 528: Lecture #5 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
Fibonacci Sequence Lecture L4.1 Lab 3.
Multiplication Discussion 11.1.
Modeling of Circuits with a Regular Structure
Fast, Asynchronous SRAM
Data Stack and Return Stack
Modeling of Circuits with Regular Structure
High-Low Guessing Game
4-Input Gates VHDL for Loops
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
Digital Logic with VHDL
Presentation transcript:

A Data Stack CoreGen Discussion 12.1

Example of the need for a stack

A 32 x 16 Stack

A 32 x 16 Stack Module

stack_ctrl32 wr_addr rd_addr 00000 11111 entity stack_ctrl is port ( clr: in STD_LOGIC; clk: in STD_LOGIC; push: in STD_LOGIC; pop: in STD_LOGIC; we: out STD_LOGIC; amsel: out STD_LOGIC; wr_addr: out STD_LOGIC_VECTOR (4 downto 0); rd_addr: out STD_LOGIC_VECTOR (4 downto 0); full: out STD_LOGIC; empty: out STD_LOGIC ); end stack_ctrl;   00000 wr_addr rd_addr 11111

stack_ctrl32 architecture stack_ctrl_arch of stack_ctrl is   architecture stack_ctrl_arch of stack_ctrl is signal full_flag, empty_flag: STD_LOGIC; begin stk: process(clr, clk, push, pop, full_flag, empty_flag) variable push_addr, pop_addr: STD_LOGIC_VECTOR(4 downto 0); if clr = '1' then push_addr := "11111"; pop_addr := "00000"; empty_flag <= '1'; full_flag <= '0'; wr_addr <= "11111"; rd_addr <= "00000"; full <= full_flag; empty <= empty_flag;

stack_ctrl32 wr_addr rd_addr 00000 elsif clk'event and clk = '1' then 11111 rd_addr wr_addr elsif clk'event and clk = '1' then if push = '1' then if pop = ‘0' then if full_flag = '0' then push_addr := push_addr - 1; pop_addr := push_addr + 1; empty_flag <= '0'; if push_addr = "11111” then full_flag <= '1'; push_addr := "00000"; end if; else –- write to top of stack (pop_addr) without pushing -- don’t change push_addr and pop_addr

stack_ctrl32 wr_addr rd_addr elsif pop = '1' then 00000 if empty_flag = '0' then pop_addr := pop_addr + 1; if full_flag = '0' then push_addr := push_addr + 1; end if; full_flag <= '0'; if pop_addr = "00000" then empty_flag <= '1'; wr_addr <= push_addr; rd_addr <= pop_addr; 00000 11111 rd_addr wr_addr

stack_ctrl wr_addr rd_addr 00000 full <= full_flag; 11111 rd_addr wr_addr full <= full_flag; empty <= empty_flag; if push = '1' and full_flag = '0' then we <= '1'; else we <= '0'; end if; if push = '1' and pop = ‘1' then amsel <= '1'; amsel <= '0'; end process stk; end stack_ctrl_arch;

A 32 x 16 Stack Module

library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; entity stack32x16 is port ( d: in STD_LOGIC_VECTOR (15 downto 0); clr: in STD_LOGIC; push: in STD_LOGIC; pop: in STD_LOGIC; clk: in STD_LOGIC; q: out STD_LOGIC_VECTOR (15 downto 0); full: out STD_LOGIC; empty: out STD_LOGIC ); end stack32x16;

architecture stack32x16_arch of stack32x16 is component stack_ctrl port( clr : in std_logic; clk : in std_logic; push : in std_logic; pop : in std_logic; we : out std_logic; amsel : out std_logic; wr_addr : out std_logic_vector(4 downto 0); rd_addr : out std_logic_vector(4 downto 0); full : out std_logic; empty : out std_logic); end component;

component mux2g generic( width : POSITIVE); port( a : in std_logic_vector((width-1) downto 0); b : in std_logic_vector((width-1) downto 0); sel : in std_logic; y : out std_logic_vector((width-1) downto 0)); end component; component dpram32x16 port ( A: IN std_logic_VECTOR(4 downto 0); CLK: IN std_logic; D: IN std_logic_VECTOR(15 downto 0); WE: IN std_logic; DPRA: IN std_logic_VECTOR(4 downto 0); DPO: OUT std_logic_VECTOR(15 downto 0); SPO: OUT std_logic_VECTOR(15 downto 0));

signal wr_addr, rd_addr : std_logic_vector(4 DOWNTO 0); signal we, amsel: std_logic; constant bus_width: integer := 5; begin mem1 : dpram32x16 port map ( A => wr2_addr, CLK => clk, D => d, WE => we, DPRA => rd_addr, DPO => q, SPO => open);

mux2: mux2g generic map(width => bus_width) port map (a => wr_addr,b => rd_addr, sel => amsel, y => wr2_addr); sa1: stack_ctrl port map (clr => clr, clk => clk, push => push, pop => pop, we => we, wr_addr => wr_addr, rd_addr => rd_addr, full => full, empty => empty, amsel => amsel); end stack32x16_arch;