21 mikroprocesor Microblaze

background image

Mikroprocesor MicroBlaze

Dariusz Chaberski

background image

§ charakterystyka

+ opis w języku HDL (ang. Hardware Description Language)

najczęściej jest to VHDL (ang. Very High Speed Circuit Integrated HDL)

+ możliwość doboru szerokości magistral, ilości rejestrów pod konkretne zastosowanie

+ możliwość implementacji dodatkowego sprzętu pod konkretne zastosowanie (liczniki, PWM,

generatory itp)

+ implementacja do układu programowalnego FPGA

+ narzędzie wspomagające EDK (ang. Embeded Development Kit) firmy Xilinx

3 aplikacja - język C

3 opis mikroprocesora - język VHDL

2

background image

§ MicroBlaze Core Block Diagram

3

background image

§ Data Types and Endianness

+ Word Data Type

4

background image

§ Half Word Data Type

5

background image

§ Byte Data Type

6

background image

§ Pipeline Architecture

7

background image

§ EDK

8

background image

9

background image

10

background image

11

background image

12

background image

13

background image

14

background image

15

background image

16

background image

17

background image

18

background image

19

background image

20

background image

21

background image

§ download.cmd

setMode -bscan

setCable -p usb21

identify

assignfile -p 4 -file implementation/download.bit

program -p 4

quit

22

background image

§ Impact

23

background image

§ *.mhs

... BEGIN lmb bram if cntlr

PARAMETER INSTANCE = ilmb cntlr

PARAMETER HW VER = 2.00.a

PARAMETER C BASEADDR = 0x00000000

PARAMETER C HIGHADDR = 0x0000ffff

BUS INTERFACE SLMB = ilmb

BUS INTERFACE BRAM PORT = ilmb port

END

BEGIN bram block

PARAMETER INSTANCE = lmb bram

PARAMETER HW VER = 1.00.a

BUS INTERFACE PORTA = ilmb port

BUS INTERFACE PORTB = dlmb port

END ...

24

background image

§ *.mss

...

BEGIN DRIVER

PARAMETER DRIVER NAME = bram

PARAMETER DRIVER VER = 1.00.a

PARAMETER HW INSTANCE = dlmb cntlr

END

BEGIN DRIVER

PARAMETER DRIVER NAME = bram

PARAMETER DRIVER VER = 1.00.a

PARAMETER HW INSTANCE = ilmb cntlr

END

...

25

background image

§ *.ucf

...

Net fpga 0 LEDs 8Bit GPIO IO pin<0> LOC = E13;

Net fpga 0 LEDs 8Bit GPIO IO pin<0> IOSTANDARD=LVCMOS25;

Net fpga 0 LEDs 8Bit GPIO IO pin<0> PULLDOWN;

Net fpga 0 LEDs 8Bit GPIO IO pin<0> SLEW=SLOW;

Net fpga 0 LEDs 8Bit GPIO IO pin<0> DRIVE=2;

Net fpga 0 LEDs 8Bit GPIO IO pin<1> LOC = D14;

Net fpga 0 LEDs 8Bit GPIO IO pin<1> IOSTANDARD=LVCMOS25;

Net fpga 0 LEDs 8Bit GPIO IO pin<1> PULLDOWN;

Net fpga 0 LEDs 8Bit GPIO IO pin<1> SLEW=SLOW;

Net fpga 0 LEDs 8Bit GPIO IO pin<1> DRIVE=2;

...

26

background image

ML 501 (Xilinx)

27

background image

28

background image

§ GPIO LED [0:7] (ML501)

29

background image

§ *.c

#include "xgpio.h"

#include "xparameters.h"

int main(void) {

XGpio gpioLED;

XGpio gpioKEY;

XGpio Initialize(&gpioLED, XPAR LEDS 8BIT DEVICE ID);

XGpio SetDataDirection(&gpioLED, 1, 0x00);

XGpio Initialize(&gpioKEY, XPAR DIP SWITCHES 8BIT DEVICE ID);

XGpio SetDataDirection(&gpioKEY, 1, 0xff);

int val;

while(1) {

val = XGpio DiscreteRead(&gpioKEY, 1);

XGpio DiscreteWrite(&gpioLED, 1, val); }

return 0; }

30

background image

§ *.c (pola bitowe)

#include "xgpio.h"

#include "xparameters.h"

struct pole bitowe

{

unsigned int : 24;

unsigned int b7 : 1;

...

unsigned int b1 : 1;

unsigned int b0 : 1;

};

#define keys *(unsigned int *)&vi

#define key0 vi.b0

...

#define leds *(unsigned int *)&vo

#define led0 vo.b0

...

31

background image

int main(void){

XGpio gpioLED;

XGpio gpioKEY;

XGpio Initialize(&gpioLED, XPAR LEDS 8BIT DEVICE ID);

XGpio SetDataDirection(&gpioLED, 1, 0x00);

XGpio Initialize(&gpioKEY, XPAR DIP SWITCHES 8BIT DEVICE ID);

XGpio SetDataDirection(&gpioKEY, 1, 0xff);

struct pole bitowe vi, vo;

while(1){

keys = XGpio DiscreteRead(&gpioKEY, 1);

led0=key0 & key1 | key2;

led1=key3 ^ key4;

//przerzutnik RS

led6=~(key6 & led7);

led7=~(key7 & led6);

XGpio DiscreteWrite(&gpioLED, 1, leds);}

return 0;}

32

background image

GPIO

33

background image

§ fpga editor *.ncd

34

background image

35

background image

SLICE (2 x CLB)

36

background image

CLB (4 x LUT, 4 x FF/LATCH)

37

background image

BRAM

38

background image

39

background image

40

background image

OPB Interrupt Controller

41

background image

42

background image

43

background image

44

background image

45

background image

46

background image

47

background image

48

background image

§ *.ucf (Interrupt pin)

Net irq pin LOC = K20; #DHR1 12 ml501

§ *.c

#include "xgpio.h"

#include "xparameters.h"

#include "xintc l.h"

int val;

void interrupt function(int num)

{

val++;

}

49

background image

int main(void)

{

XIntc RegisterHandler(XPAR OPB INTC 0 BASEADDR, XPAR OPB INTC 0 MTM IRQ PIN INTR,

(XInterruptHandler)interrupt function, (void*)0);

XIntc mMasterEnable(XPAR OPB INTC 0 BASEADDR);

XIntc mEnableIntr(XPAR OPB INTC 0 BASEADDR, XPAR MTM IRQ PIN MASK);

microblaze enable interrupts();

XGpio gpioLED;

XGpio Initialize(&gpioLED, XPAR LEDS 8BIT DEVICE ID);

XGpio SetDataDirection(&gpioLED, 1, 0x00);

while(1)

{

XGpio DiscreteWrite(&gpioLED, 1, val);

}

return 0;

}

50


Wyszukiwarka

Podobne podstrony:
W 21 Alkohole
21 02 2014 Wykład 1 Sala
21 Fundamnety przyklady z praktyki
BO I WYKLAD 01 3 2011 02 21
mikroprocesor 2
w 1 komunikacja 21 11 09 nst
21 25
21 23
2009 06 15 21;42;51
2011 03 05 21;05;08
2002 06 21
21
2006 SOM 208 Microbiology Syllabus Septic Shock
Kodeks pracy Dziennik Ustaw poz 94 nr 21 z 1998 roku
2011 03 05 21;10;59
2004 06 21

więcej podobnych podstron