林家葦
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Lab2: RISC-V RV32I[MA] emulator with ELF support ###### tags: `Computer Architecture` ## Mutipiler ### Compile C code ``` = void main(){ int mul1 = 10000; int mul2 = -200; int result = 0 ; int i ; for(i=0;i<32;i++) { if((mul2 >> i) & 0x1) result = result + (mul1 << i); } printInt(result); } void printInt(int result){ volatile char* tx = (volatile char*) 0x40002000; int dict[9] ={1,10,100,1000,10000,100000,1000000,10000000,100000000}; int mx = 900000000,i,j,isprint=0; if(result >> 31){ *tx = '-'; result = -result; } for(i=8;i>=0;i=i-1){ int print = -1; for(j=9;j>=1;j--){ if ( result >= mx){ isprint =1; print = j; result = result - mx; } mx = (j!=1)? (mx - dict[i]):(mx-dict[i-1]); } if(print!=-1) *tx = (print+48); else if (isprint) *tx = 48; } } ``` Compile without optimization ```= .file "test.c" .option nopic .text .align 2 .globl main .type main, @function main: addi sp,sp,-32 sw ra,28(sp) sw s0,24(sp) addi s0,sp,32 li a5,8192 addi a5,a5,1808 sw a5,-28(s0) li a5,-200 sw a5,-32(s0) sw zero,-20(s0) sw zero,-24(s0) j .L2 .L4: lw a5,-24(s0) lw a4,-32(s0) sra a5,a4,a5 andi a5,a5,1 beqz a5,.L3 lw a5,-24(s0) lw a4,-28(s0) sll a5,a4,a5 lw a4,-20(s0) add a5,a4,a5 sw a5,-20(s0) .L3: lw a5,-24(s0) addi a5,a5,1 sw a5,-24(s0) .L2: lw a4,-24(s0) li a5,31 ble a4,a5,.L4 lw a0,-20(s0) call printInt nop lw ra,28(sp) lw s0,24(sp) addi sp,sp,32 jr ra .size main, .-main .section .rodata .align 2 .LC0: .word 1 .word 10 .word 100 .word 1000 .word 10000 .word 100000 .word 1000000 .word 10000000 .word 100000000 .text .align 2 .globl printInt .type printInt, @function printInt: addi sp,sp,-96 sw s0,92(sp) addi s0,sp,96 sw a0,-84(s0) li a5,1073750016 sw a5,-40(s0) lui a5,%hi(.LC0) lw t1,%lo(.LC0)(a5) addi a4,a5,%lo(.LC0) lw a7,4(a4) addi a4,a5,%lo(.LC0) lw a6,8(a4) addi a4,a5,%lo(.LC0) lw a0,12(a4) addi a4,a5,%lo(.LC0) lw a1,16(a4) addi a4,a5,%lo(.LC0) lw a2,20(a4) addi a4,a5,%lo(.LC0) lw a3,24(a4) addi a4,a5,%lo(.LC0) lw a4,28(a4) addi a5,a5,%lo(.LC0) lw a5,32(a5) sw t1,-76(s0) sw a7,-72(s0) sw a6,-68(s0) sw a0,-64(s0) sw a1,-60(s0) sw a2,-56(s0) sw a3,-52(s0) sw a4,-48(s0) sw a5,-44(s0) li a5,900001792 addi a5,a5,-1792 sw a5,-20(s0) sw zero,-32(s0) lw a5,-84(s0) bgez a5,.L6 lw a5,-40(s0) li a4,45 sb a4,0(a5) lw a5,-84(s0) neg a5,a5 sw a5,-84(s0) .L6: li a5,8 sw a5,-24(s0) j .L7 .L15: li a5,-1 sw a5,-36(s0) li a5,9 sw a5,-28(s0) j .L8 .L12: lw a4,-84(s0) lw a5,-20(s0) blt a4,a5,.L9 li a5,1 sw a5,-32(s0) lw a5,-28(s0) sw a5,-36(s0) lw a4,-84(s0) lw a5,-20(s0) sub a5,a4,a5 sw a5,-84(s0) .L9: lw a4,-28(s0) li a5,1 beq a4,a5,.L10 lw a5,-24(s0) slli a5,a5,2 addi a4,s0,-16 add a5,a4,a5 lw a5,-60(a5) lw a4,-20(s0) sub a5,a4,a5 j .L11 .L10: lw a5,-24(s0) addi a5,a5,-1 slli a5,a5,2 addi a4,s0,-16 add a5,a4,a5 lw a5,-60(a5) lw a4,-20(s0) sub a5,a4,a5 .L11: sw a5,-20(s0) lw a5,-28(s0) addi a5,a5,-1 sw a5,-28(s0) .L8: lw a5,-28(s0) bgtz a5,.L12 lw a4,-36(s0) li a5,-1 beq a4,a5,.L13 lw a5,-36(s0) andi a5,a5,0xff addi a5,a5,48 andi a4,a5,0xff lw a5,-40(s0) sb a4,0(a5) j .L14 .L13: lw a5,-32(s0) beqz a5,.L14 lw a5,-40(s0) li a4,48 sb a4,0(a5) .L14: lw a5,-24(s0) addi a5,a5,-1 sw a5,-24(s0) .L7: lw a5,-24(s0) bgez a5,.L15 nop lw s0,92(sp) addi sp,sp,96 jr ra .size printInt, .-printInt .ident "GCC: (xPack GNU RISC-V Embedded GCC, 64-bit) 8.2.0" ``` Compile with optimization ``` .file "test.c" .option nopic .text .align 2 .globl printInt .type printInt, @function printInt: lui a5,%hi(.LANCHOR0) addi a5,a5,%lo(.LANCHOR0) lw t3,0(a5) lw t1,4(a5) lw a7,8(a5) lw a6,12(a5) lw a1,16(a5) lw a2,20(a5) lw a3,24(a5) lw a4,28(a5) lw a5,32(a5) addi sp,sp,-48 sw t3,12(sp) sw t1,16(sp) sw a7,20(sp) sw a6,24(sp) sw a1,28(sp) sw a2,32(sp) sw a3,36(sp) sw a4,40(sp) sw a5,44(sp) bgez a0,.L2 li a5,1073750016 li a4,45 sb a4,0(a5) neg a0,a0 .L2: li a5,900001792 addi a1,sp,12 addi t1,sp,-24 li a6,0 addi a3,a5,-1792 li t4,-1 li t3,1073750016 li t5,48 .L4: bgt a3,a0,.L18 sub a0,a0,a3 li a2,57 li a7,9 li a6,1 .L6: lw a4,32(a1) sub a5,a3,a4 blt a0,a5,.L7 sub a0,a0,a5 li a2,56 li a7,8 li a6,1 .L7: sub a5,a5,a4 blt a0,a5,.L8 sub a0,a0,a5 li a2,55 li a7,7 li a6,1 .L8: sub a5,a5,a4 blt a0,a5,.L9 sub a0,a0,a5 li a2,54 li a7,6 li a6,1 .L9: sub a5,a5,a4 blt a0,a5,.L10 sub a0,a0,a5 li a2,53 li a7,5 li a6,1 .L10: sub a5,a5,a4 blt a0,a5,.L11 sub a0,a0,a5 li a2,52 li a7,4 li a6,1 .L11: sub a5,a5,a4 blt a0,a5,.L12 sub a0,a0,a5 li a2,51 li a7,3 li a6,1 .L12: lw a3,28(a1) sub a5,a5,a4 sub a4,a5,a4 sub a3,a4,a3 blt a0,a5,.L13 sub a0,a0,a5 ble a4,a0,.L14 li a2,50 li a6,1 .L15: sb a2,0(t3) .L3: addi a1,a1,-4 bne t1,a1,.L4 addi sp,sp,48 jr ra .L14: sub a0,a0,a4 li a2,49 li a6,1 j .L15 .L13: bge a0,a4,.L14 bne a7,t4,.L15 beqz a6,.L3 sb t5,0(t3) j .L3 .L18: li a2,47 li a7,-1 j .L6 .size printInt, .-printInt .section .text.startup,"ax",@progbits .align 2 .globl main .type main, @function main: li a2,8192 li a5,1 li a0,0 li a6,-200 addi a2,a2,1808 li a1,32 .L29: sra a4,a6,a5 andi a4,a4,1 sll a3,a2,a5 addi a5,a5,1 beqz a4,.L28 add a0,a0,a3 .L28: bne a5,a1,.L29 tail printInt .size main, .-main .section .rodata .align 2 .set .LANCHOR0,. + 0 .LC0: .word 1 .word 10 .word 100 .word 1000 .word 10000 .word 100000 .word 1000000 .word 10000000 .word 100000000 .ident "GCC: (xPack GNU RISC-V Embedded GCC, 64-bit) 8.2.0" ``` ### Execute without compile -O3 And program executes 10000*(-200) ``` ./emu-rv32i test -2000000 >>> Execution time: 66615 ns >>> Instruction count: 2430 (IPS=36478270) >>> Jumps: 315 (12.96%) - 191 forwards, 124 backwards >>> Branching T=226 (65.51%) F=119 (34.49%) ``` with compile -O3 ``` ./emu-rv32i test -2000000 >>> Execution time: 20103 ns >>> Instruction count: 549 (IPS=27309356) >>> Jumps: 134 (24.41%) - 77 forwards, 57 backwards >>> Branching T=115 (68.05%) F=54 (31.95%) ``` ### GNU-TOOL **objdump** Compile with -O3 ``` $ riscv-none-embed-objdump -d test test: file format elf32-littleriscv Disassembly of section .text: 00000100 <_start>: 100: 00000093 li ra,0 104: 00000113 li sp,0 108: 00000193 li gp,0 10c: 00000213 li tp,0 110: 00000293 li t0,0 114: 00000313 li t1,0 118: 00000393 li t2,0 11c: 00000413 li s0,0 120: 00000493 li s1,0 124: 00000513 li a0,0 128: 00000593 li a1,0 12c: 00000613 li a2,0 130: 00000693 li a3,0 134: 00000713 li a4,0 138: 00000793 li a5,0 13c: 00000813 li a6,0 140: 00000893 li a7,0 144: 00000913 li s2,0 148: 00000993 li s3,0 14c: 00000a13 li s4,0 150: 00000a93 li s5,0 154: 00000b13 li s6,0 158: 00000b93 li s7,0 15c: 00000c13 li s8,0 160: 00000c93 li s9,0 164: 00000d13 li s10,0 168: 00000d93 li s11,0 16c: 00000e13 li t3,0 170: 00000e93 li t4,0 174: 00000f13 li t5,0 178: 00000f93 li t6,0 0000017c <init_stack>: 17c: 00001117 auipc sp,0x1 180: 28810113 addi sp,sp,648 # 1404 <__stack> 00000184 <SystemInit>: 184: 00c000ef jal ra,190 <main> 188: 0040006f j 18c <SystemExit> 0000018c <SystemExit>: 18c: 00000073 ecall 00000190 <main>: 190: fe010113 addi sp,sp,-32 194: 00112e23 sw ra,28(sp) 198: 00812c23 sw s0,24(sp) 19c: 02010413 addi s0,sp,32 1a0: 000027b7 lui a5,0x2 1a4: 71078793 addi a5,a5,1808 # 2710 <__stack+0x130c> 1a8: fef42223 sw a5,-28(s0) 1ac: f3800793 li a5,-200 1b0: fef42023 sw a5,-32(s0) 1b4: fe042623 sw zero,-20(s0) 1b8: fe042423 sw zero,-24(s0) 1bc: 03c0006f j 1f8 <main+0x68> 1c0: fe842783 lw a5,-24(s0) 1c4: fe042703 lw a4,-32(s0) 1c8: 40f757b3 sra a5,a4,a5 1cc: 0017f793 andi a5,a5,1 1d0: 00078e63 beqz a5,1ec <main+0x5c> 1d4: fe842783 lw a5,-24(s0) 1d8: fe442703 lw a4,-28(s0) 1dc: 00f717b3 sll a5,a4,a5 1e0: fec42703 lw a4,-20(s0) 1e4: 00f707b3 add a5,a4,a5 1e8: fef42623 sw a5,-20(s0) 1ec: fe842783 lw a5,-24(s0) 1f0: 00178793 addi a5,a5,1 1f4: fef42423 sw a5,-24(s0) 1f8: fe842703 lw a4,-24(s0) 1fc: 01f00793 li a5,31 200: fce7d0e3 bge a5,a4,1c0 <main+0x30> 204: fec42503 lw a0,-20(s0) 208: 018000ef jal ra,220 <printInt> 20c: 00000013 nop 210: 01c12083 lw ra,28(sp) 214: 01812403 lw s0,24(sp) 218: 02010113 addi sp,sp,32 21c: 00008067 ret 00000220 <printInt>: 220: fa010113 addi sp,sp,-96 224: 04812e23 sw s0,92(sp) 228: 06010413 addi s0,sp,96 22c: faa42623 sw a0,-84(s0) 230: 400027b7 lui a5,0x40002 234: fcf42c23 sw a5,-40(s0) 238: 3e002303 lw t1,992(zero) # 3e0 <printInt+0x1c0> 23c: 3e000713 li a4,992 240: 00472883 lw a7,4(a4) 244: 3e000713 li a4,992 248: 00872803 lw a6,8(a4) 24c: 3e000713 li a4,992 250: 00c72503 lw a0,12(a4) 254: 3e000713 li a4,992 258: 01072583 lw a1,16(a4) 25c: 3e000713 li a4,992 260: 01472603 lw a2,20(a4) 264: 3e000713 li a4,992 268: 01872683 lw a3,24(a4) 26c: 3e000713 li a4,992 270: 01c72703 lw a4,28(a4) 274: 3e000793 li a5,992 278: 0207a783 lw a5,32(a5) # 40002020 <__stack+0x40000c1c> 27c: fa642a23 sw t1,-76(s0) 280: fb142c23 sw a7,-72(s0) 284: fb042e23 sw a6,-68(s0) 288: fca42023 sw a0,-64(s0) 28c: fcb42223 sw a1,-60(s0) 290: fcc42423 sw a2,-56(s0) 294: fcd42623 sw a3,-52(s0) 298: fce42823 sw a4,-48(s0) 29c: fcf42a23 sw a5,-44(s0) 2a0: 35a4f7b7 lui a5,0x35a4f 2a4: 90078793 addi a5,a5,-1792 # 35a4e900 <__stack+0x35a4d4fc> 2a8: fef42623 sw a5,-20(s0) 2ac: fe042023 sw zero,-32(s0) 2b0: fac42783 lw a5,-84(s0) 2b4: 0007de63 bgez a5,2d0 <printInt+0xb0> 2b8: fd842783 lw a5,-40(s0) 2bc: 02d00713 li a4,45 2c0: 00e78023 sb a4,0(a5) 2c4: fac42783 lw a5,-84(s0) 2c8: 40f007b3 neg a5,a5 2cc: faf42623 sw a5,-84(s0) 2d0: 00800793 li a5,8 2d4: fef42423 sw a5,-24(s0) 2d8: 0f00006f j 3c8 <printInt+0x1a8> 2dc: fff00793 li a5,-1 2e0: fcf42e23 sw a5,-36(s0) 2e4: 00900793 li a5,9 2e8: fef42223 sw a5,-28(s0) 2ec: 08c0006f j 378 <printInt+0x158> 2f0: fac42703 lw a4,-84(s0) 2f4: fec42783 lw a5,-20(s0) 2f8: 02f74263 blt a4,a5,31c <printInt+0xfc> 2fc: 00100793 li a5,1 300: fef42023 sw a5,-32(s0) 304: fe442783 lw a5,-28(s0) 308: fcf42e23 sw a5,-36(s0) 30c: fac42703 lw a4,-84(s0) 310: fec42783 lw a5,-20(s0) 314: 40f707b3 sub a5,a4,a5 318: faf42623 sw a5,-84(s0) 31c: fe442703 lw a4,-28(s0) 320: 00100793 li a5,1 324: 02f70263 beq a4,a5,348 <printInt+0x128> 328: fe842783 lw a5,-24(s0) 32c: 00279793 slli a5,a5,0x2 330: ff040713 addi a4,s0,-16 334: 00f707b3 add a5,a4,a5 338: fc47a783 lw a5,-60(a5) 33c: fec42703 lw a4,-20(s0) 340: 40f707b3 sub a5,a4,a5 344: 0240006f j 368 <printInt+0x148> 348: fe842783 lw a5,-24(s0) 34c: fff78793 addi a5,a5,-1 350: 00279793 slli a5,a5,0x2 354: ff040713 addi a4,s0,-16 358: 00f707b3 add a5,a4,a5 35c: fc47a783 lw a5,-60(a5) 360: fec42703 lw a4,-20(s0) 364: 40f707b3 sub a5,a4,a5 368: fef42623 sw a5,-20(s0) 36c: fe442783 lw a5,-28(s0) 370: fff78793 addi a5,a5,-1 374: fef42223 sw a5,-28(s0) 378: fe442783 lw a5,-28(s0) 37c: f6f04ae3 bgtz a5,2f0 <printInt+0xd0> 380: fdc42703 lw a4,-36(s0) 384: fff00793 li a5,-1 388: 02f70063 beq a4,a5,3a8 <printInt+0x188> 38c: fdc42783 lw a5,-36(s0) 390: 0ff7f793 andi a5,a5,255 394: 03078793 addi a5,a5,48 398: 0ff7f713 andi a4,a5,255 39c: fd842783 lw a5,-40(s0) 3a0: 00e78023 sb a4,0(a5) 3a4: 0180006f j 3bc <printInt+0x19c> 3a8: fe042783 lw a5,-32(s0) 3ac: 00078863 beqz a5,3bc <printInt+0x19c> 3b0: fd842783 lw a5,-40(s0) 3b4: 03000713 li a4,48 3b8: 00e78023 sb a4,0(a5) 3bc: fe842783 lw a5,-24(s0) 3c0: fff78793 addi a5,a5,-1 3c4: fef42423 sw a5,-24(s0) 3c8: fe842783 lw a5,-24(s0) 3cc: f007d8e3 bgez a5,2dc <printInt+0xbc> 3d0: 00000013 nop 3d4: 05c12403 lw s0,92(sp) 3d8: 06010113 addi sp,sp,96 3dc: 00008067 ret ``` **readelf** ``` $ riscv-none-embed-readelf -h test ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: RISC-V Version: 0x1 Entry point address: 0x100 Start of program headers: 52 (bytes into file) Start of section headers: 1584 (bytes into file) Flags: 0x0 Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 1 Size of section headers: 40 (bytes) Number of section headers: 9 Section header string table index: 8 ``` **size** ``` $ riscv-none-embed-size test text data bss dec hex filename 772 0 4096 4868 1304 test ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully