Programming Example Lecture 8.6 A VHDL Forth Core for FPGAs: Sect. 7.

Slides:



Advertisements
Similar presentations
Arbitrary Waveform Discussion 5.5 Example 34.
Advertisements

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
Multiplication Discussion Multiplier Binary Multiplication 4 x 4 Multiplier.
A Simple Microcontroller VHDL Tutorial R. E. Haskell and D. M. Hanna T6: VHDL State Machines.
Data Stack Lecture 8.2 A VHDL Forth Core for FPGAs: Sect. 3.
Simple Sequential Circuits in VHDL. Contents Sequential circuit examples: - SR latch in dataflow style - D flip-flop in behavioral style - shift register.
Return Stack Lecture 8.4 A VHDL Forth Core for FPGAs: Sect. 5.
Single-Cycle Instructions VHDL Tutorial R. E. Haskell and D. M. Hanna T5: VHDL ROM.
Multi-Base Calculator CSE378 Final Project By Matthew Lehn & Yanqing Zhu December 17, 2001 Professor Haskell.
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.
Objective The object of the game is to convert as many hexadecimal numbers to binary coded decimal numbers correctly within thirty (30) seconds. How.
Lab 6 Program Counter and Program ROM Mano & Kime Sections 7-1 – 7-6.
Multiplication Discussion Multiplier Binary Multiplication 4 x 4 Multiplier.
Digilab DIO2 LCD Module F5.1. DIO2 circuit board block diagram.
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.
The FC16 Forth Core Lab 7 Module F4.1. Lab 7 Hex OpcodeNameFunction 0000NOP No operation 0001DUP Duplicate T and push data stack. N
Return Stack Lecture L7.3. A 32 x 16 Stack Same as used in the Data Stack in Lab 7.
FPGAs and VHDL Lecture L13.1 Sections 13.1 – 13.3.
Digilab 7-Segment Displays Lab 4. selyInstruction name “000”true if b = a false otherwise = “001”true if b /= a false otherwise “010”true if b < a.
Finite State Machines Discussion D8.1 Example 36.
7-Segment Displays Digilent Spartan 3 Board Discussion DS-4.2.
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.
Introduction to VHDL Multiplexers Discussion D1.1.
Lab 3 & 4 Discussion EE414/514 VHDL Design September 25.
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
LCD Display DIO2 Board CPLD. DIO2 Board CPLD Interface LCD Display.
RS-232 Port Lecture L9.3. Loop feedback RS-232 voltage levels: +5.5 V (logic 0) -5.5 V (logic 1)
Data Stack Instructions Lab 7. Data Stack WHYP Data Stack Instructions DUP( n -- n n ) SWAP( a b -- b a ) DROP( a -- ) OVER( a b -- a b a ) ROT( a.
4-Bit Binary-to-BCD Converter: case Statement
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);
Other WC16 Instructions Lecture L7.4. OpcodeNameFunctionNumber of Clock Cycles Fetch the byte at address T in RAM and load it into T1 Fetch.
4-bit Shift Register. 2-bit Register Serial-in-serial-out Shift Register.
LAB 9 Finite State Machine (FSM) Ui Luu Glendale Community College Bassam Matar Chandler-Gilbert Community College.
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
EE3A1 Computer Hardware and Digital Design Lecture 5 Testbenches and Memories in VHDL.
ENG2410 Digital Design LAB #5 Modular Design and Hierarchy using VHDL.
Main Project : Simple Processor Mini-Project : 3-bit binary counter (using 7400 series) Memory By Oluwayomi B. Adamo.
Reaction Timer Project
2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.
Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
 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.
CS/EE 3700 : Fundamentals of Digital System Design
Copyright (c) 2003 by Valery Sklyarov and Iouliia Skliarova: DETUA, IEETA, Aveiro University, Portugal.
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
Lecture 11 Xilinx FPGA Memories Part 2
Prime Numbers Lecture L6.1 Sieve of Eratosthenes.
LAB #5 Modular Design and Hierarchy using VHDL
Main Project : Simple Processor Mini-Project : Vending Machine Memory
Describing Combinational Logic Using Processes
Fast, Asynchronous SRAM
A Data Stack CoreGen Discussion 12.1.
VHDL (VHSIC Hardware Description Language)
A Greatest Common Divisor (GCD) Processor
Fibonacci Sequence Lecture L4.1 Lab 3.
Behavioral Modeling of Sequential-Circuit Building Blocks
Figure 8.1. The general form of a sequential circuit.
DIO2 Board Projects.
Fast, Asynchronous SRAM
High-Low Guessing Game
4-Input Gates VHDL for Loops
Return Stack Lab 8.
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
Presentation transcript:

Programming Example Lecture 8.6 A VHDL Forth Core for FPGAs: Sect. 7

Digilab D2E Development Board

Digilab DIO2 Peripheral Board

Using the FC16 Forth Core ( addr – data ) DIO2! ( data addr -- )

Accessing the DIO2 Peripheral Board ( addr – data ) DIO2! ( data addr -- )

library IEEE; use IEEE.STD_LOGIC_1164.all; entity buff3 is generic (width:positive); port( input : in STD_LOGIC_vector(width-1 downto 0); en : in STD_LOGIC; output : out STD_LOGIC_vector(width-1 downto 0) ); end buff3; architecture buff3 of buff3 is begin output 'Z'); end buff3; buff3.vhd en output input

Seven-segment LED display

constant DIO2store: opcode := X"010F"; -- DIO2! constant LCDistore: opcode := X"0110"; -- LCDinst! constant LCDdstore: opcode := X"0111"; -- LCDdata! In opcodes.vhd

MultiCC: process (clk, clr, current_state) begin if clr = '1' then ccycle <= "000001"; elsif (clk'event and clk = '1') then if current_state = exec then ccycle <= ccycle + 1; else ccycle <= "000001"; end if; end process MultiCC; signal ccycle: STD_LOGIC_VECTOR (5 downto 0); In FC16_control add….

when exec =>-- execute instr without fetching next one if (icode = X"010E" or icode = X"010F") and ccycle < 3 then next_state <= exec; elsif (icode = X"0110" or icode = X"0111") and ccycle < 8 then next_state <= exec; --elsif icode = X"Code_for_multi-cycle" --and ccycle < Num_cc_to_exec then --next_state <= exec; else next_state <= fetch;-- go to fetch state end if; In FC16_control add….

when DIO2store => cs <= '1'; oe <= '0'; pinc <= '0'; if ccycle = 1 then we <= '1'; else tload <= '1'; nload <= '1'; tsel <= "111"; nsel <= "01"; dpop <= '1'; end if; In FC16_control add…. DIO2! ( data addr.. )

data_out <= btns(7 downto 0) when addr(1 downto 0) = "00" else '0'& btns(14 downto 8) when addr(1 downto 0) = "01" else switchs; constant DIO2fetch: opcode := X"003A"; -- From DIO2 CPLD In opcodes.vhd In FC16_control.vhd In FC16.vhd E1 <= ground & data_io; data <= data_io; when DIO2fetch =>-- read 8-bit DIO2-bus (E1) tload <= '1'; -- ( addr – data ) tsel <= "100"; cs <= '1'; oe <= '1';

\ Test of DIO2 buttons, LEDs, and 7-seg displays : D2DIG! ( n -- )\ Display n on 7-segment displays DUP 8 RSHIFT \ n nHI 7 DIO2! \ display nHI 6 DIO2! ; \ display nLO : D2LD! ( n -- )\ Display n on the 16 LEDs DUP 8 RSHIFT\ n nHI 5 DIO2! \ display nHI 4 DIO2! ; \ display nLO : get.BTN2( -- n )\ Push 15-button bit mask to T 1 \ btns(15:8) 8 LSHIFT 0 \ btns(7:0) OR ;

: waitBTN2 ( -- n)\ Wait to push a button and get mask BEGIN \ wait to lift finger get.BTN2 0= UNTIL BEGIN \ wait to press button get.BTN2 UNTIL get.BTN2 ; \ get buttons

: but>num ( n1 -- n2 ) \ convert button bit mask to button no. 15 FOR \ loop 15 times DUP 1 = IF \ value matches R> \ get loop value 15 SWAP - \ find index 1 >R \ break out of loop ELSE U2/ \ Shift button value THEN NEXT NIP ; \ remove extra 1 from N

: main( -- )\ main program BEGIN waitBTN2\ wait to push BTN2 DUP D2LD! \ display on LEDs but>num\ find button number D2DIG! \ display on 7-seg display AGAIN ;

type rom_array is array (NATURAL range <>) of STD_LOGIC_VECTOR (15 downto 0); constant rom: rom_array := ( JMP, --0 X"0047", D2DIG! dup, --2 LIT, --3 X"0008", --4 rshift, --5 LIT, --6 X"0007", --7 DIO2store, --8 LIT, --9 X"0006", --a DIO2store, --b RET, --c -- D2LD! dup, --d LIT, --e X"0008", --f rshift, --10 LIT, --11 X"0005", --12 DIO2store, --13 LIT, --14 X"0004", --15 DIO2store, --16 RET, --17

-- get.BTN2 LIT, --18 X"0001", --19 DIO2fetch, --1a LIT, --1b X"0008", --1c lshift, --1d LIT, --1e X"0000", --1f DIO2fetch, --20 orr, --21 RET, waitBTN2 CALL, --23 X"0018", --24 zeroequal, --25 JZ, --26 X"0023", --27 CALL, --28 X"0018", --29 JZ, --2a X"0028", --2b CALL, --2c X"0018", --2d RET, --2e

-- btn>num LIT, --2f X"000f", --30 tor, --31 dup, --32 LIT, --33 X"0001", --34 eq, --35 JZ, --36 X"0042", --37 rfrom, --38 LIT, --39 X"000f", --3a swap, --3b minus, --3c LIT, --3d X"0001", --3e tor, --3f JMP, --40 X"0043", --41 u2slash, --42 drjne, --43 X"0032", --44 nip, --45 RET, --46

-- main CALL, --47 X"0023", --48 dup, --49 CALL, --4a X"000d", --4b CALL, --4c X"002f", --4d CALL, --4e X"0002", --4f JMP, --50 X"0047", --51 X"0000" --52 );

Relative speed of FPGA Forth core