Decoupled Value Prediction on Trace Processors - PowerPoint PPT Presentation

1 / 41
About This Presentation
Title:

Decoupled Value Prediction on Trace Processors

Description:

8051 4 (full-duplex) ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 42
Provided by: ackr
Category:

less

Transcript and Presenter's Notes

Title: Decoupled Value Prediction on Trace Processors


1
8051????
  • ?????? ???????
  • ???

2
? ?
  • 4??? ?? ??? ?? ???(full-duplex) ????? ?? ??
  • ???? ???? ?? 2? ??(double buffer)? ??
  • ??? ?? CPU? ?? ??? ???? ???? ???? ?? ???? ????
    ??? ??
  • ?? ? ?? ??? ???? SBUF? ??
  • ????? CPU? ??? ???? SBUF? ????? ?? ??? ?? ??? ??
    ????? ????,
  • CPU? SBUF? ???? ?? ????? ????.

3
SCON ????
  • Serial Port Control Register

4
SCON ????
  • TI ? RI ??
  • ?? 1??? ??? ???? ???? ???(empty)
  • 1??? ???? ???? ?? ??(full) 1? ???? ????? ?????
    ???
  • TB8 ? RB8 ??
  • ?? 2? ?? 3? 11?? ????? 9?? ??? ??? ??
  • ?? 1?? SM20? ?? RDB8? ???? ??
  • SM0SM1 ??? ?? ??? ?? ??? ??

5
SCON ????
  • SM2 ??
  • 1? ???? ?? 2? ?? 3?? 9?? ??? RB81? ????? ???? ??
    ?? ????? ???? RB80? ???? ????? ???? ???.
  • ?? 1?? SM21? ???? ??? ??? ??? ?? ??? ???? ???
    ???? ????? ????.
  • ? MOV SCON, 52H 01010010B
  • SM0 SM1 01 ?? 1, SM2 0
  • REN 1 receive enable
  • TI 1 transmint interrupt flag

6
PCON ????
  • Power Control Register

7
PCON ????
  • ???? ???? ??? 1? ???? ???? SMOD ??? ???? ????? 2?
    ?? ??
  • ?? ??? ?? ?? 13?? SMOD0?? ???? ????? ????,
  • SMOD1?? ????? 2? ?? ??? ????.
  • SMOD0
  • 0?? SCON.7 ??? SM0?? ????,
  • 1?? SCON.7 ??? FE(Framing Error)? ????.

8
?? ?? 0
  • ??? ???(half-duplex) ?? ??
  • ??? ?? ??? ??????? ?? I/O ????? ???? ?? ?
  • ? ????? TXD ??? ??? ???? ????, RXD? ?? ??? ?? ?
    ?? ??? ????.
  • ??? ???? ?? 8??? ???? LSB?? ????, ????? ??? ???
    1/12? ????.

9
?? ?? 0
  • ?? ??
  • SBUF? ?? ???? ??????? ????,
  • 1?? ??? ?? LSB(b0)?? ??? ????. ??? 1?? ???? 1???
    ????,
  • MSB? ???? ?? TI ???? ??? 1? ????.
  • ?? ??
  • REN1? ???? ???? ???? ?? RI? 0?? ?????? ?? ????
    ??? ??
  • RXD ??? ???? ?? ???? ? ??? TXD ??? ???? ?? ???
    ??? ?? ???? ?? ?? ??? ?? ??? ????? ??? ??
  • 8??? ???? ?? ???? ??? ????? ???? SBUF? ???? ??
    ???? ?? RI? 1? ????.

10
?? ?? 1
  • ?? ?? ???? ???? 10?? ???(1 ??? ??, 8 ??? ??, 1 ??
    ??)? ??? ?? ??
  • ????? ??? 1?? ??? 2? ???? ???? ??? ??
  • ??? 2? ???? ???? ?? ??? ?? ??? ?? ????? ?????? ?
    ???? ???? ??? ??? 1? ???? ?? ??? ??? 2? ????? ???
    ?? ??.

11
?? ?? 1
  • ?? ??
  • SBUF? ?? ???? ??????? ??
  • SBUF? ????? ?? ?? ??? ????? 9?? ??? 1? ????, ???
    ????? ?? ??? ????.
  • ????? 9?? ??? ?? ??? ???? ???? ??? TI? ???? ????
    ????? ????.
  • ?? ??
  • REN1? ???? RXD ??? ?? ??? ???? ??
  • ??? ??? ???? ?????? ?? 8??? ??? D0D7? ???? ???
    ????? ??

12
?? ?? 1
  • ????? 9??? ?? ??? 1? ???? ?????? RI0? ???? RI?
    1? ???? ?? ????? ????
  • ?? SCON ?????? SM20?? ?? ??? ??? ???? RI0??? ??
    RI? ????.
  • ??? ?? ??? SCON ????? RB8? ????, 8?? ??? ??? ???
    ?????? SBUF? ????.

13
?? ?? 2? 3
  • 11?? ???(1 ??? ??, 8 ??? ??, ??????? 9?? ??, 1 ??
    ??)? ??? ?? ??
  • ?? 3? ?? ?? ?????? ????? ???? ??? ??? ??
  • 9?? ??? SCON ????? TB8 ??? ??????? ????, ??? 9??
    ??? SCON ????? RB8 ??? ????.
  • SCON ?????? SM21? ???? RB8 ??? 1? ????? ???? ??
    ?? ????? ???? 0?? ??? ???? ????? ???? ???.

14
?? ?? 2? 3
  • ?? 3? ?? 2? ??? ??? ???? ?? ?????? ???.
  • ?? 2??? ????? ??? ??? 1/32?? 1/64? ??? ? ??? ???,
  • ?? 3??? ????? ??? 1?? ??? 2? ???? ??? ??? ? ??.

15
????(Baud rate)? ??
  • ?? ??? ?? ?? 1? 3
  • ??? 1? ???? ??? ??? 2? ???? ??? ??.
  • ???? ??? 1? ???? ???? ??? 1? ?? 2(8?? auto-reload
    mode)? ???? ???? ??? ??
  • ???2? ???? ????? ????? ??? ?? ??. ??? ??? 2?
    16?? ???? ??? ??? ????? ??? ??? 11.0592MHz? ?????
    ??? ??? ????? ???? ? ??.

16
????(Baud rate)? ??
17
????(Baud rate)? ??
18
???? ?? ??
19
???? ?? ??
20
???? ? 1
  • ????? OK-8051 ???? PC? ???? ???? ????
  • p.581 asm12_1.asm ???? ??
  • ???? ??? sw1sw4? ??? ??? ??? ?? ??? ???? PC?
    ???? PC? ??? ???? ????
  • PC? ??? ???? ??
  • ?? 1 ??
  • MOV SCON, 52H SM0 SM1 01 ?? 1, SM2
    0REN 1 receive enableTI 1 transmint
    interrupt flag, ?? ???? ??

21
???? ? 1
  • ???2 ???? ???? ??
  • ????? J1 ??? ?? 9600bps? 19200bps ??
  • PPI_PORTC? MSB1 ?? 19200bps, 0?? 9600bps
  • 19200bps gt ??? 65516 9600bps gt ??? 65497
  • Initialize Serial Port
  • INIT_232
  • MOV T2MOD,00H timer 2 baud rate
    generator
  • MOV T2CON,34H baud rate
    generator mode, TR21
  • MOV DPTR,PPI_PORTC 9600 or 19200 bps ?
  • MOVX A,_at_DPTR
  • JB ACC.7, BPS_19200

22
???? ? 1
  • MOV DPTR,65497 9600 bps
  • MOV RCAP2H,DPH
  • MOV RCAP2L,DPL
  • JMP OK_232
  • BPS_19200
  • MOV DPTR,65516 19200 bps
  • MOV RCAP2H,DPH
  • MOV RCAP2L,DPL
  • OK_232
  • MOV SCON,52H (8 bit, 1 stop, REN TI 1)
  • MOV TXD_BUFFER,SBUF dummy read
  • RET

23
???? ? 1
  • ????
  • ???? ??? ?? TI ?? ??? ?? ??TXD_CH JNB TI,TXD_CH
    transmit ready ?
  • CLR TI if yes, clear TI and transmit
  • MOV SBUF, TXD_BUFFER
  • RET

24
???? ? 1
  • INCLUDE(C\C51\ASM\OK8051.INC)
  • CR EQU 0DH carriage return
  • LF EQU 0AH line feed
  • Main Program
  • CSEG AT 8000H RAM start address of OK-8051
  • CALL LCD_HOME1 display title
  • LCALL LCD_STRING
  • DB ' RS-232C ',0
  • CALL LCD_HOME2
  • LCALL LCD_STRING
  • DB 'Press SW1-SW4 ! ',0
  • CLR EA disable interrupts
  • CALL INIT_232 initialize 80C32 serial port

25
???? ? 1
  • READ_KEY
  • CALL KEY_IN key input
  • CJNE A,00001110B,CK_KEY2 SW1 ?
  • MOV DPTR,PPI_PORTA turn on LED1
  • MOV A,00000001B
  • MOVX _at_DPTR,A
  • CALL TXD_STRING transmit string by serial
    port
  • DB 'SW1 was pressed.',CR,LF,0
  • JMP READ_KEY
  • CK_KEY2
  • CJNE A,00001101B,CK_KEY3 SW2 ?
  • MOV DPTR,PPI_PORTA turn on LED2
  • MOV A,00000010B
  • MOVX _at_DPTR,A
  • CALL TXD_STRING transmit string by serial
    port
  • DB 'SW2 was pressed.',CR,LF,0
  • JMP READ_KEY

26
???? ? 1
  • CK_KEY3
  • CJNE A,00001011B,CK_KEY4 SW3 ?
  • MOV DPTR,PPI_PORTA turn on LED3
  • MOV A,00000100B
  • MOVX _at_DPTR,A
  • CALL TXD_STRING transmit string by serial
    port
  • DB 'SW3 was pressed.',CR,LF,0
  • JMP READ_KEY
  • CK_KEY4
  • CJNE A,00000111B,READ_KEY SW4 ?
  • MOV DPTR,PPI_PORTA turn on LED4
  • MOV A,00001000B
  • MOVX _at_DPTR,A
  • CALL TXD_STRING transmit string by serial
    port
  • DB 'SW4 was pressed.',CR,LF,0
  • JMP READ_KEY

27
???? ? 1
  • Initialize Serial Port
  • INIT_232
  • MOV T2MOD,00H timer 2 baud rate
    generator
  • MOV T2CON,34H
  • MOV DPTR,PPI_PORTC 9600 or 19200 bps ?
  • MOVX A,_at_DPTR
  • JB ACC.7,BPS_19200
  • MOV DPTR,65497 9600 bps
  • MOV RCAP2H,DPH
  • MOV RCAP2L,DPL
  • JMP OK_232
  • BPS_19200
  • MOV DPTR,65516 19200 bps
  • MOV RCAP2H,DPH
  • MOV RCAP2L,DPL

28
???? ? 1
  • OK_232
  • MOV SCON,52H (8 bit, 1 stop, REN TI 1)
  • MOV TXD_BUFFER,SBUF dummy read
  • RET
  • Transmit a Character(TXD_BUFFER)
  • TXD_CH
  • JNB TI,TXD_CH transmit ready ?
  • CLR TI if yes, clear TI and transmit
  • MOV SBUF,TXD_BUFFER
  • RET
  • Transmit ASCII String
  • TXD_STRING
  • POP DPH get start address of string
  • POP DPL

29
???? ? 1
  • TXD_STR1
  • CLR A read a character. end string ?
  • MOVC A,_at_ADPTR
  • JZ TXD_STR2 if yes, return
  • MOV TXD_BUFFER,A if no, transmit a character
  • CALL TXD_CH
  • INC DPTR
  • JMP TXD_STR1
  • TXD_STR2
  • INC DPTR store new return address
  • PUSH DPL
  • PUSH DPH
  • RET
  • END

30
???? ? 2
  • ????? OK-8051 ???? PC? ???? ????, PC? ??? ?? ???
    ???? ??? ?? ????
  • p.586 asm12_3.asm ???? ??
  • PC? ??? ???? ? 1? ????? ?? ???? ??
  • PC???? ??? ???? ??

31
???? ? 2
  • ???
  • ??? ?? ? ???? ??
  • ???? ????? ???? Q ??? ?? ????? ?? ???? ??? ?????
    ???? ???? ??? ?? ??? ?????? ??? KIT_FLAG.4 ??
  • CLR EA disable interrupts
  • CALL INIT_232 initialize 80C32 serial port
  • SETB KIT_FLAG.4 set user serial interrupt flag
  • SETB ES enable serial interrupts
  • SETB EA

32
???? ? 2
  • ?? ???? ?? ??
  • RXD_CH
  • JNB RI,RXD_CH1 receive ready ?
  • MOV LCD_BUFFER,SBUF if yes, receive and clear
    RI
  • CLR RI
  • CALL LCD_DATA display a character
  • INC CURSOR 16 characters OK ?
  • MOV A,17
  • CJNE A,CURSOR,RXD_CH1
  • MOV CURSOR,1
  • MOV LCD_BUFFER,0C0H
  • CALL LCD_COMMAND
  • CALL BEEP
  • RXD_CH1
  • RETI

33
???? ? 2
  • CSEG AT 0FF23H TI, RI interrupt vectoring
  • JMP RXD_CH
  • END

34
???? ? 2
  • INCLUDE(C\C51\ASM\OK8051.INC)
  • CR EQU 0DH carriage return
  • LF EQU 0AH line feed
  • Main Program
  • CSEG AT 8000H
  • CALL LCD_HOME1 display title
  • LCALL LCD_STRING
  • DB ' RS-232C ',0
  • CALL LCD_HOME2
  • LCALL LCD_STRING
  • DB ' ',0
  • CLR EA disable interrupts
  • CALL INIT_232 initialize 80C32 serial port
  • SETB KIT_FLAG.4 set user serial interrupt
    flag
  • SETB ES enable serial interrupts
  • SETB EA

35
???? ? 2
  • MOV CURSOR,1 initialize cursor position
  • MOV LCD_BUFFER,0C0H
  • CALL LCD_COMMAND
  • MOV LCD_BUFFER,0FH cursor ON
  • CALL LCD_COMMAND
  • Key Scan and Transmit a String
  • READ_KEY
  • CALL KEY_IN key input
  • CJNE A,00001110B,CK_KEY2 SW1 ?
  • MOV DPTR,PPI_PORTA turn on LED1
  • MOV A,00000001B
  • MOVX _at_DPTR,A
  • CALL TXD_STRING transmit string by serial
    port
  • DB 'SW1 was pressed.',CR,LF,0
  • JMP READ_KEY
  • CK_KEY2
  • CJNE A,00001101B,CK_KEY3 SW2 ?

36
???? ? 2
  • MOV DPTR,PPI_PORTA turn on LED2
  • MOV A,00000010B
  • MOVX _at_DPTR,A
  • CALL TXD_STRING transmit string by serial
    port
  • DB 'SW2 was pressed.',CR,LF,0
  • JMP READ_KEY
  • CK_KEY3
  • CJNE A,00001011B,CK_KEY4 SW3 ?
  • MOV DPTR,PPI_PORTA turn on LED3
  • MOV A,00000100B
  • MOVX _at_DPTR,A
  • CALL TXD_STRING transmit string by serial
    port
  • DB 'SW3 was pressed.',CR,LF,0
  • JMP READ_KEY
  • CK_KEY4
  • CJNE A,00000111B,READ_KEY SW4 ?
  • MOV DPTR,PPI_PORTA turn on LED4

37
???? ? 2
  • MOV A,00001000B
  • MOVX _at_DPTR,A
  • CALL TXD_STRING transmit string by serial
    port
  • DB 'SW4 was pressed.',CR,LF,0
  • JMP READ_KEY
  • Subroutines to Communicate by Serial Port
  • Initialize Serial Port
  • INIT_232
  • MOV T2MOD,00H timer 2 baud rate generator
  • MOV T2CON,34H
  • MOV DPTR,PPI_PORTC 9600 or 19200 bps ?
  • MOVX A,_at_DPTR
  • JB ACC.7,BPS_19200
  • MOV DPTR,65497 9600 bps
  • MOV RCAP2H,DPH
  • MOV RCAP2L,DPL
  • JMP OK_232

38
???? ? 2
  • BPS_19200
  • MOV DPTR,65516 19200 bps
  • MOV RCAP2H,DPH
  • MOV RCAP2L,DPL
  • OK_232
  • MOV SCON,52H (8 bit, 1 stop, REN TI 1)
  • MOV TXD_BUFFER,SBUF dummy read
  • RET
  • Transmit a Character(TXD_BUFFER)
  • TXD_CH
  • JNB TI,TXD_CH transmit ready ?
  • CLR TI if yes, clear TI and transmit
  • MOV SBUF,TXD_BUFFER
  • RET
  • Transmit ASCIIZ String
  • TXD_STRING
  • POP DPH get start address of string
  • POP DPL

39
???? ? 2
  • TXD_STR1
  • CLR A read a character. end string ?
  • MOVC A,_at_ADPTR
  • JZ TXD_STR2 if yes, return
  • MOV TXD_BUFFER,A if no, transmit a character
  • CALL TXD_CH
  • INC DPTR
  • JMP TXD_STR1
  • TXD_STR2
  • INC DPTR store new return address
  • PUSH DPL
  • PUSH DPH
  • RET
  • Serial Port Interrupt Service Routine
  • RXD_CH
  • JNB RI,RXD_CH1 receive ready ?
  • MOV LCD_BUFFER,SBUF if yes, receive and clear
    RI

40
???? ? 2
  • CLR RI
  • CALL LCD_DATA display a character
  • INC CURSOR 16 characters OK ?
  • MOV A,17
  • CJNE A,CURSOR,RXD_CH1
  • MOV CURSOR,1
  • MOV LCD_BUFFER,0C0H
  • CALL LCD_COMMAND
  • CALL BEEP
  • RXD_CH1
  • RETI
  • CSEG AT 0FF23H TI, RI interrupt vectoring
  • JMP RXD_CH
  • END

41
???? ??
  • ???? ?2? ?????? ??? ??? LCD ??? ????? ?? ?? ????
    PC? ??? ???? echo back ??? ??? ????? ????
Write a Comment
User Comments (0)
About PowerShow.com