Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 448 – FPGA and ASIC Design with VHDL George Mason University Lab 1 Introduction to Aldec Active HDL Implementing Combinational Logic in VHDL.

Similar presentations


Presentation on theme: "ECE 448 – FPGA and ASIC Design with VHDL George Mason University Lab 1 Introduction to Aldec Active HDL Implementing Combinational Logic in VHDL."— Presentation transcript:

1 ECE 448 – FPGA and ASIC Design with VHDL George Mason University Lab 1 Introduction to Aldec Active HDL Implementing Combinational Logic in VHDL

2 Example 1: MLU Introduction to Aldec Active-HDL

3 MLU Block Diagram

4 Experiment 1 Problem 1 ALU of PIC Microcontroller

5 Pertinent Components of PIC Working Register 70 W 00000 00001 00010 11111 7 7 7 7 0 0 0 0 Register File (32 Registers) Address 00011 70 00100 70 STATUS 00101 70 00110 70 00111 70 8 Special Function Registers 01000 70 24 General Purpose Registers

6 Addressing Modes Immediate mode ANDLW H’6C’ Direct mode ANDWF H’12’, 0 W & 0x6C  W W & (0x12)  W

7 Assembly language vs. Machine Code Assembly language mnemonic [operands] ANDLW H’6C’ Machine code ‘000101’ ‘010010’ opcode [operands] ANDWF H’12’, 0 ‘1110’ ‘01101100’

8 Status Register STATUS 0 7 Z DC C Carry/Borrow Digit Carry (3 rd  4 th bit) Zero Power-down Time-out Program Page Preselect Reserved

9 Definition of the Status Register Flags (1) Z = 1 if result = 0 0 otherwise Zero flag - Z zero result C = 1 if result > MAX_UNSIGNED or result < 0 0 otherwise where MAX_UNSIGNED = 2 8 -1 for 8-bit results Carry flag - C out-of-range for unsigned numbers

10 Definition of the Status Register Flags (2) DC = 1 if carry from bit 3 to bit 4 (ADDWF) or no borrow from bit 4 to 3 (SUBWF) 0 otherwise Digit Carry flag – DC Carry / Borrow between MSB of first hex digit and LSB of second 111 1 00100110 + 00011100 0100 0010 00101110 - 00011100 0001 0010 DC = 1

11 Logic Instructions 1.AND ANDWFW & RF  W or RF ANDLW W & L  W 2. Inclusive OR IORWFW | RF  W or RF IORLWW | L  W 3. Exclusive OR XORWF W  RF  W or RF XORLWW  L  W 4.Ones Complement COMF RF  RF DIR Z C DC DIR IMM DIR – DIR IMM

12 Arithmetic Instructions 1. Addition ADDWF W + RF  W or RF 2.Subtraction SUBWF RF – W  W or RF DIR 3.Increment INCFRF + 1  RF 4.Decrement DECFRF - 1  RF DIR Z C DC DIR –

13 Shifts and Rotation Instructions 1. Rotate Left Through Carry RLF 2. Rotate Right Through Carry RRF 3. Swap Nibbles SWAPFRF [7:4]  W [3:0] or RF [3:0] RF [4:0]  W [7:4] or RF [7:4] DIR Z C DC DIR – x x – – – 07... C 0 7 C

14 Instruction Summary

15 Example 2 Mini ALU

16 opcode A B M R Mini ALU 4 4 4 4 4

17 MnemonicOperationOpcode ADDABR= A + B0000 ADDAMR = A + M0001 SUBABR = A - B0010 SUBAMR = A - M0011 NOTAR = NOT A0100 NOTBR = NOT B0101 NOTMR = NOT M0110 ANDABR = A AND B0111 ANDAMR = A AND M1000 ORABR = A OR B1001 ORAMR = A OR M1010 XORABR = A XOR B1011 XORAMR = A XOR M1100

18 Block diagram

19 Example 3 Variable Rotator

20 Function C = A <<< B A – 4-bit data input B – 2-bit rotation amount

21 Interface 4 4 2 A B C

22 Block diagram C

23 Fixed Shifts in VHDL A(3)A(2) A(1) A(0) A(3)A(2)A(1) A>>1 A_shiftR <= ‘0’ & A(3 downto 1); ‘0’

24 Arithmetic Functions in VHDL (1) To use arithmetic operations involving std_logic_vectors you need to include the following library packages: library ieee; use ieee.std_logic_1164.all; use ieee.STD_LOGIC_UNSIGNED.ALL;

25 Arithmetic Functions in VHDL (2) You can use standard +, - operators to perform addition and subtraction: signal A : STD_LOGIC_VECTOR(3 downto 0); signal B : STD_LOGIC_VECTOR(3 downto 0); signal C : STD_LOGIC_VECTOR(3 downto 0); …… C<= A + B;


Download ppt "ECE 448 – FPGA and ASIC Design with VHDL George Mason University Lab 1 Introduction to Aldec Active HDL Implementing Combinational Logic in VHDL."

Similar presentations


Ads by Google