Removed kernel
This commit is contained in:
BIN
kernel/.DS_Store
vendored
BIN
kernel/.DS_Store
vendored
Binary file not shown.
@@ -1,25 +0,0 @@
|
||||
|
||||
COMP = /opt/riscv/bin/riscv32-unknown-elf-gcc
|
||||
# COMP = /opt/riscv/bin/riscv32-unknown-linux-gnu-gcc
|
||||
CC_FLAGS = -march=rv32im -mabi=ilp32 -O0 -Wl,-Bstatic,-T,linker.ld -ffreestanding -nostdlib
|
||||
|
||||
DMP = /opt/riscv/bin/riscv32-unknown-elf-objdump
|
||||
CPY = /opt/riscv/bin/riscv32-unknown-elf-objcopy
|
||||
|
||||
# DMP = /opt/riscv/bin/riscv32-unknown-linux-gnu-objdump
|
||||
# CPY = /opt/riscv/bin/riscv32-unknown-linux-gnu-objcopy
|
||||
|
||||
VX_LIB = ./vx_os/vx_back/vx_back.s ./vx_os/vx_back/vx_back.c ./vx_os/vx_util/queue.s
|
||||
VX_IO = ./vx_os/vx_io/vx_io.s ./vx_os/vx_io/vx_io.c
|
||||
VX_FR = ./vx_include/vx_front.c
|
||||
|
||||
all: HEX DUMP ELF
|
||||
|
||||
DUMP: ELF
|
||||
$(DMP) -D vortex_test.elf > vortex_test.dump
|
||||
|
||||
HEX: ELF
|
||||
$(CPY) -O ihex vortex_test.elf vortex_test.hex
|
||||
|
||||
ELF:
|
||||
$(COMP) $(CC_FLAGS) $(VX_LIB) $(VX_IO) $(VX_FR) vx_main.c -o vortex_test.elf
|
||||
@@ -1,48 +0,0 @@
|
||||
/* ---- Original Script: /opt/riscv32i/riscv32-unknown-elf/lib/ldscripts/elf32lriscv.x ---- */
|
||||
/* Default linker script, for normal executables */
|
||||
/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
||||
Copying and distribution of this script, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. */
|
||||
OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv",
|
||||
"elf32-littleriscv")
|
||||
OUTPUT_ARCH(riscv)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x80000000;
|
||||
.text :
|
||||
{
|
||||
*(.text)
|
||||
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
|
||||
*(.text.exit .text.exit.*)
|
||||
*(.text.startup .text.startup.*)
|
||||
*(.text.hot .text.hot.*)
|
||||
*(.stub .text.* .gnu.linkonce.t.*)
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
}
|
||||
.init :
|
||||
{
|
||||
KEEP (*(SORT_NONE(.init)))
|
||||
}
|
||||
.plt : { *(.plt) }
|
||||
.iplt : { *(.iplt) }
|
||||
.fini :
|
||||
{
|
||||
KEEP (*(SORT_NONE(.fini)))
|
||||
}
|
||||
PROVIDE (__etext = .);
|
||||
PROVIDE (_etext = .);
|
||||
PROVIDE (etext = .);
|
||||
PROVIDE (_edata = .);
|
||||
PROVIDE (_end = .);
|
||||
PROVIDE (__global_pointer$ = .);
|
||||
|
||||
. = 0x81000000;
|
||||
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
|
||||
.rodata1 : { *(.rodata1) }
|
||||
. = 0x82000000;
|
||||
.comment : { *(.comment) }
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,436 +0,0 @@
|
||||
:0200000480007A
|
||||
:1000000037F1FF7FEF101004130500006B000500AF
|
||||
:10001000938B0600130D0700130F010093030500D7
|
||||
:1000200013051000635C75001301018013030500C4
|
||||
:100030006B500300130515006FF0DFFE1300000086
|
||||
:100040001300000013000000130000001300000064
|
||||
:100050001300000013010F0013050000930F0600AA
|
||||
:10006000938D030013000000130000001300000034
|
||||
:100070001300000013000000130000001300000034
|
||||
:1000800013000000EBE0BF011300000013000000AC
|
||||
:100090001300000013000000130000001300000014
|
||||
:1000A000170500001305451B6B40050017030000F2
|
||||
:1000B000130343F66B000300678000001702000182
|
||||
:1000C000130282252320020023221200232422006F
|
||||
:1000D0002326320023284200232A5200232C6200C8
|
||||
:1000E000232E720023208202232292022324A202C2
|
||||
:1000F0002326B2022328C202232AD202232CE202A0
|
||||
:10010000232EF20223200205232212052324220596
|
||||
:100110002326320523284205232A5205232C620573
|
||||
:10012000232E720523208207232292072324A2076D
|
||||
:100130002326B2072328C207232AD207232CE2074B
|
||||
:10014000232EF2071302100067800000170200013F
|
||||
:100150001302821C0320020083204200032182003C
|
||||
:100160008321C20003220201832242010323820170
|
||||
:100170008323C20103240202832442020325820254
|
||||
:100180008325C20203260203832642030327820338
|
||||
:100190008327C2030328020483284204032982041C
|
||||
:1001A0008329C204032A0205832A4205032B820500
|
||||
:1001B000832BC205032C0206832C4206032D8206E4
|
||||
:1001C000832DC206032E0207832E4207032F8207C8
|
||||
:1001D000832FC2071302000067800000732500020E
|
||||
:1001E000678000007325100267800000130101FE84
|
||||
:1001F000232E1100232C810013040102232604FE68
|
||||
:100200006F0040030327C4FEB7170000938747978A
|
||||
:100210003307F702B707008193874741B307F70019
|
||||
:1002200013850700EF0000448327C4FE938717005F
|
||||
:100230002326F4FE0327C4FE9307F001E3D4E7FC72
|
||||
:10024000130000008320C101032481011301010276
|
||||
:1002500067800000130101FD23261102232481027F
|
||||
:100260002322A103130401031300000013070D0050
|
||||
:10027000B7170000938747973307F702B707008146
|
||||
:1002800093874741B307F70013850700EF004050FD
|
||||
:1002900093070500638A070213070D00B707008163
|
||||
:1002A000131727009387C726B307F700130710001B
|
||||
:1002B00023A0E70093070D0063960700EFF01FE906
|
||||
:1002C0006F00C0057300000013070D00B717000092
|
||||
:1002D000938747973307F702B70700819387474112
|
||||
:1002E000B307F700130784FD930507001385070084
|
||||
:1002F000EF000040832704FE138107008327C4FD1D
|
||||
:10030000832584FD032644FE832684FE0327C4FE42
|
||||
:1003100013850700EFF0DFCF730000008320C102D8
|
||||
:1003200003248102032D41021301010367800000B1
|
||||
:10033000130101FB23261104232481041304010566
|
||||
:10034000EFF0DFE92324A4FE9309010093071000D6
|
||||
:100350002326F4FE6F00C0080327C4FEB717000071
|
||||
:10036000938747973307F702B70700819387474181
|
||||
:10037000B307F70013850700EF00804193070500DE
|
||||
:10038000639A07040327C4FEB717000093874797B3
|
||||
:100390003307F702B707008193874741B307F70098
|
||||
:1003A000130704FD9305070013850700EF00403491
|
||||
:1003B000832784FD13810700832744FD832504FDE3
|
||||
:1003C0000326C4FD832604FE032744FE138507008D
|
||||
:1003D000EFF0DFCD8327C4FE938717002326F4FEBA
|
||||
:1003E0008327C4FE032784FEE3E8E7F613810900B0
|
||||
:1003F000EFF0DFCC9307020063880704B7070081A2
|
||||
:1004000013854741EF00C03893070500639E07023C
|
||||
:10041000930784FB93850700B70700811385474145
|
||||
:10042000EF00002D832704FC138107008327C4FB02
|
||||
:10043000832584FB032644FC832684FC0327C4FC19
|
||||
:1004400013850700EFF0DFBC130000008320C10418
|
||||
:10045000032481041301010567800000130101FBDF
|
||||
:10046000232611042324810413040105232EA4FA56
|
||||
:10047000232CB4FA232AC4FA2328D4FAEFF01FD786
|
||||
:10048000EFF0DFD52322A4FE13090100232604FE8A
|
||||
:10049000232404FE6F000009B709FFFF3301310177
|
||||
:1004A000832784FE2326F4FC832784FB2328F4FC83
|
||||
:1004B00093070100232AF4FC832744FB232CF4FC3C
|
||||
:1004C000832704FB232EF4FC8327C4FE2320F4FEA1
|
||||
:1004D0000327C4FEB7170000938747973307F70237
|
||||
:1004E000B707008193874741B307F7001307C4FCA0
|
||||
:1004F0009305070013850700EF0000198327C4FE4A
|
||||
:10050000938717002326F4FE8327C4FE032744FEA7
|
||||
:1005100063E4E700232604FE832784FE9387170005
|
||||
:100520002324F4FE032784FE8327C4FBE366F7F647
|
||||
:1005300013010900EFF0DFDF130000008320C10486
|
||||
:10054000032481041301010567800000130101FDEC
|
||||
:10055000232611022324810213040103232EA4FC69
|
||||
:100560008325C4FDB707008113850704EF00802DA4
|
||||
:10057000EFF0DFC62320A4FE232604FE6F008006D2
|
||||
:10058000930710002326F4FE232404FE6F00C0030B
|
||||
:10059000B7070081032784FE131727009387C72618
|
||||
:1005A000B307F70003A70700930710006318F700CD
|
||||
:1005B0008327C4FE938717002326F4FE832784FE37
|
||||
:1005C000938717002324F4FE032784FE9307F0018A
|
||||
:1005D000E3D0E7FC8325C4FEB70700811385C70479
|
||||
:1005E000EF0040260327C4FE8327C4FDE36AF7F823
|
||||
:1005F000232204FE6F008002B7070081032744FE18
|
||||
:10060000131727009387C726B307F70023A0070017
|
||||
:10061000832744FE938717002322F4FE832744FE9A
|
||||
:10062000032704FEE3EAE7FC130000008320C10275
|
||||
:10063000032481021301010367800000130101FFFD
|
||||
:1006400023268100232471011304010193870B00E9
|
||||
:10065000138507000324C100832B810013010101CE
|
||||
:1006600067800000930205001303000093037000ED
|
||||
:1006700023A0620023A2620023A4620023A67200CA
|
||||
:1006800023A86200678000009302050003A3820094
|
||||
:100690001303130023A462001383420183AE4200BC
|
||||
:1006A00093935E003303730003AE05002320C30160
|
||||
:1006B00003AE45002322C30103AE85002324C301FA
|
||||
:1006C00003AEC5002326C30103AE05012328C301E1
|
||||
:1006D00003AE4501232AC301938E1E00130F20038E
|
||||
:1006E0006394EE01930E000023A2D2016780000004
|
||||
:1006F0009302050003A38200130000001300000012
|
||||
:10070000130000001300000013000000130000009D
|
||||
:100710001303F3FF23A462001383420183AE02009C
|
||||
:10072000930F2003138F0E00130F1F006314FF019C
|
||||
:10073000130F000023A0E20193935E0033037300C4
|
||||
:10074000032E030023A0C501032E430023A2C501ED
|
||||
:10075000032E830023A4C501032EC30023A6C501D5
|
||||
:10076000032E030123A8C501032E430123AAC501BB
|
||||
:10077000678000009302050003A3820013050000B8
|
||||
:10078000130E200363146E0013051500678000002C
|
||||
:100790009302050003A3820013050000130E00005E
|
||||
:1007A00063146E00130515006780000093020500B6
|
||||
:1007B00003A3C20083A3020133B563006780000076
|
||||
:1007C000130141FF232011002322B10083450500BE
|
||||
:1007D00063880500EF00C001130515006FF01FFFCF
|
||||
:1007E00083200100832541001301C10067800000C0
|
||||
:1007F000B708010023A0B80067800000130101FEC4
|
||||
:10080000232E1100232C8100130401022326A4FEB1
|
||||
:10081000B70700810327C4FE131727009387871AA1
|
||||
:10082000B307F70083A7070013850700EFF05FF910
|
||||
:10083000130000008320C101032481011301010280
|
||||
:1008400067800000130101FE232E1100232C81007C
|
||||
:10085000130401022326A4FE2324B4FE0325C4FEB0
|
||||
:10086000EFF01FF6032584FEEFF05FF9B707008174
|
||||
:1008700013854709EFF0DFF4130000008320C10166
|
||||
:10088000032481011301010267800000130101FDAF
|
||||
:10089000232611022324810213040103232EA4FC26
|
||||
:1008A000232CB4FC232AC4FC2328D4FCB767028180
|
||||
:1008B0000327C4FD23AEE71AB76702819387C71BDE
|
||||
:1008C000032784FD23A2E700B76702819387C71B34
|
||||
:1008D000032744FD23A4E700B76702819387C71B62
|
||||
:1008E000032704FD23A6E700EFF0DF8F2324A4FEF7
|
||||
:1008F000032704FD832784FEB357F7022326F4FE63
|
||||
:10090000032704FD832784FEB377F702638807007B
|
||||
:100910008327C4FE938717002326F4FEB76702815E
|
||||
:100920009387C71B0327C4FE23A8E700032704FD02
|
||||
:10093000832784FE6362F702B76702819386C71B31
|
||||
:10094000B71700801386079B832584FE032504FDCB
|
||||
:10095000EFF0DFB06F000002B76702819386C71B1C
|
||||
:10096000B71700801386079B832504FD032504FD2C
|
||||
:10097000EFF0DFAEEFF09F862322A4FE032704FDF5
|
||||
:10098000832744FE63F8E700032544FEEFF01FBC15
|
||||
:100990006F00C000032504FDEFF05FBB13000000F3
|
||||
:1009A0008320C10203248102130101036780000038
|
||||
:1009B000130101FA232E1104232C810413040106D0
|
||||
:1009C0002326A4FA2324B4FAEFF05FC7232CA4FC57
|
||||
:1009D000832784FD83A70700232AF4FC832784FD53
|
||||
:1009E00083A747002328F4FC832784FD83A787007F
|
||||
:1009F0002326F4FC832784FD83A707012326F4FE26
|
||||
:100A00000327C4FE8327C4FAB307F7022324F4FEA6
|
||||
:100A10008327C4FE639A0700930710002326F4FE81
|
||||
:100A20008327C4FA2324F4FE832784FD83A7C70009
|
||||
:100A30002324F4FC232204FE6F00800D232004FEF7
|
||||
:100A4000232E04FC6F008007032784FA832784FC8D
|
||||
:100A5000B307F7020327C4FDB307F7002322F4FC12
|
||||
:100A6000032784FC8327C4FDB307F702032784FE12
|
||||
:100A7000B307F7002320F4FC832744FC9397270057
|
||||
:100A8000032744FDB307F70003A70700832704FCEF
|
||||
:100A900093972700832604FDB387F60083A70700FA
|
||||
:100AA000B307F702032704FEB307F7002320F4FE81
|
||||
:100AB0008327C4FD93871700232EF4FC0327C4FD6E
|
||||
:100AC000832784FCE362F7F8032784FA832784FCF6
|
||||
:100AD0003307F702832784FEB307F700232EF4FAC7
|
||||
:100AE0008327C4FB939727000327C4FCB307F700B1
|
||||
:100AF000032704FE23A0E700832784FE93871700C3
|
||||
:100B00002324F4FE832744FE938717002322F4FE58
|
||||
:100B1000832744FE0327C4FEE3E2E7F2130000004C
|
||||
:100B20008320C105032481051301010667800000AD
|
||||
:100B3000130101FC232E1102232C81021304010452
|
||||
:100B4000232EA4FC232CB4FC232AC4FC2328D4FC8D
|
||||
:100B50002326E4FCB76702810327C4FD23A8E71C12
|
||||
:100B6000B76702819387071D032784FD23A2E7004F
|
||||
:100B7000B76702819387071D032744FD23A4E7007D
|
||||
:100B8000B76702819387071D0327C4FC23A6E700EC
|
||||
:100B9000B76702819387071D032704FD23A8E70099
|
||||
:100BA000EFF04FE42324A4FE0327C4FC832784FE34
|
||||
:100BB000B357F7022326F4FE0327C4FC832784FEE1
|
||||
:100BC000B377F702638807008327C4FE9387170073
|
||||
:100BD0002326F4FEB76702819387071D0327C4FE0F
|
||||
:100BE00023AAE7000327C4FC832784FE6362F7027D
|
||||
:100BF000B76702819386071DB7170080138687C6E3
|
||||
:100C0000832584FE032504FDEFF05F856F0000025D
|
||||
:100C1000B76702819386071DB7170080138687C6C2
|
||||
:100C20008325C4FC032504FDEFF05F83EFF00FDBA9
|
||||
:100C30002322A4FE032704FD832744FE63F8E70074
|
||||
:100C4000032544FEEFF09F906F00C000032504FDD4
|
||||
:100C5000EFF0DF8F130000008320C1030324810322
|
||||
:100C60001301010467800000130101FB2326110416
|
||||
:100C70002324810413040105232EA4FA232CB4FA9F
|
||||
:100C8000EFF0DF9B2320A4FE832704FE83A7070049
|
||||
:100C9000232EF4FC832704FE83A74700232CF4FCB7
|
||||
:100CA000832704FE83A78700232AF4FC832704FEFE
|
||||
:100CB00083A747012326F4FE0327C4FE8327C4FB32
|
||||
:100CC000B307F7022324F4FE8327C4FE639A0700C8
|
||||
:100CD000930710002326F4FE8327C4FB2324F4FE8D
|
||||
:100CE000832704FE83A7C7002328F4FC232204FEE5
|
||||
:100CF0006F00000C032784FB832704FD3307F702F2
|
||||
:100D0000832784FEB307F7002326F4FC032784FE21
|
||||
:100D1000832704FDB337F70093F7F70F2324F4FC80
|
||||
:100D2000832784FC93B71700A303F4FC834774FC68
|
||||
:100D3000138F0700B7170080938FC7D96B200F0060
|
||||
:100D40007B70FF018327C4FC939727000327C4FD12
|
||||
:100D5000B307F70083A607008327C4FC93972700F7
|
||||
:100D6000032784FDB307F70003A707008327C4FC0C
|
||||
:100D700093972700032644FDB307F6003387E60068
|
||||
:100D800023A0E700832784FE938717002324F4FE23
|
||||
:100D9000B7170080138E07DA67000E0013000000FB
|
||||
:100DA0006B300000832744FE938717002322F4FE54
|
||||
:100DB000832744FE0327C4FEE3EEE7F2130000009E
|
||||
:100DC0008320C1040324810413010105678000000E
|
||||
:100DD000130101FC232E1102232C810213040104B0
|
||||
:100DE000232EA4FC232CB4FC232AC4FC2328D4FCEB
|
||||
:100DF0002326E4FCB76702810327C4FD23A8E71C70
|
||||
:100E0000B76702819387071D032784FD23A2E700AC
|
||||
:100E1000B76702819387071D032744FD23A4E700DA
|
||||
:100E2000B76702819387071D0327C4FC23A6E70049
|
||||
:100E3000B76702819387071D032704FD23A8E700F6
|
||||
:100E4000EFF04FBA2324A4FE0327C4FC832784FEBB
|
||||
:100E5000B357F7022326F4FE0327C4FC832784FE3E
|
||||
:100E6000B377F702638807008327C4FE93871700D0
|
||||
:100E70002326F4FEB76702819387071D0327C4FE6C
|
||||
:100E800023AAE7000327C4FC832784FE6362F702DA
|
||||
:100E9000B76702819386071DB7170080138687F016
|
||||
:100EA000832584FE032504FDEFF04FDB6F00000275
|
||||
:100EB000B76702819386071DB7170080138687F0F6
|
||||
:100EC0008325C4FC032504FDEFF04FD9EFF00FB1EB
|
||||
:100ED0002322A4FE032704FD832744FE63F8E700D2
|
||||
:100EE000032544FEEFF08FE66F00C000032504FDEC
|
||||
:100EF000EFF0CFE5130000008320C103032481033A
|
||||
:100F00001301010467800000130101FB2326110473
|
||||
:100F10002324810413040105232EA4FA232CB4FAFC
|
||||
:100F2000EFF0CFF12320A4FE832704FE83A7070060
|
||||
:100F3000232EF4FC832704FE83A74700232CF4FC14
|
||||
:100F4000832704FE83A78700232AF4FC832704FE5B
|
||||
:100F500083A747012326F4FE0327C4FE8327C4FB8F
|
||||
:100F6000B307F7022324F4FE8327C4FE639A070025
|
||||
:100F7000930710002326F4FE8327C4FB2324F4FEEA
|
||||
:100F8000832704FE83A7C7002328F4FC232204FE42
|
||||
:100F90006F00000C032784FB832704FD3307F7024F
|
||||
:100FA000832784FEB307F7002326F4FC032784FE7F
|
||||
:100FB000832704FDB337F70093F7F70F2324F4FCDE
|
||||
:100FC000832784FC93B71700A303F4FC834774FCC6
|
||||
:100FD000138F0700B7170080938FC7036B200F0094
|
||||
:100FE0007B70FF018327C4FC939727000327C4FD70
|
||||
:100FF000B307F70083A607008327C4FC9397270055
|
||||
:10100000032784FDB307F70003A707008327C4FC69
|
||||
:1010100093972700032644FDB307F6003387E64085
|
||||
:1010200023A0E700832784FE938717002324F4FE80
|
||||
:10103000B7170080138E070467000E00130000002E
|
||||
:101040006B300000832744FE938717002322F4FEB1
|
||||
:10105000832744FE0327C4FEE3EEE7F213000000FB
|
||||
:101060008320C1040324810413010105678000006B
|
||||
:10107000130101FC232E1102232C8102130401040D
|
||||
:10108000232EA4FC232CB4FC232AC4FC2328D4FC48
|
||||
:101090002326E4FCB76702810327C4FD23A4E71ECF
|
||||
:1010A000B76702819387871E032784FD23A2E70089
|
||||
:1010B000B76702819387871E032744FD23A4E700B7
|
||||
:1010C000B76702819387871E0327C4FC23A6E70026
|
||||
:1010D000B76702819387871E032704FD23A8E700D3
|
||||
:1010E000EFF04F902324A4FE0327C4FC832784FE43
|
||||
:1010F000B357F7022326F4FE0327C4FC832784FE9C
|
||||
:10110000B377F702638807008327C4FE938717002D
|
||||
:101110002326F4FEB76702819387871E0327C4FE48
|
||||
:1011200023AAE7000327C4FC832784FE6362F70237
|
||||
:10113000B76702819386871EB71700801386871AC8
|
||||
:10114000832584FE032504FDEFF04FB16F000002FC
|
||||
:10115000B76702819386871EB71700801386871AA8
|
||||
:101160008325C4FC032504FDEFF04FAFEFF00F879C
|
||||
:101170002322A4FE032704FD832744FE63F8E7002F
|
||||
:10118000032544FEEFF08FBC6F00C000032504FD73
|
||||
:10119000EFF0CFBB130000008320C10303248103C1
|
||||
:1011A0001301010467800000130101FB23261104D1
|
||||
:1011B0002324810413040105232EA4FA232CB4FA5A
|
||||
:1011C000EFF0CFC72320A4FE832704FE83A70700E8
|
||||
:1011D000232EF4FC832704FE83A7470083A7070080
|
||||
:1011E000232CF4FC832704FE83A78700232AF4FC26
|
||||
:1011F000832704FE83A747012326F4FE0327C4FEAA
|
||||
:101200008327C4FBB307F7022324F4FE8327C4FE1D
|
||||
:10121000639A0700930710002326F4FE8327C4FB7C
|
||||
:101220002324F4FE832704FE83A7C7002328F4FCAD
|
||||
:10123000232204FE6F00000B032784FB832704FD99
|
||||
:101240003307F702832784FEB307F7002326F4FC55
|
||||
:10125000032784FE832704FDB337F70093F7F70FC6
|
||||
:101260002324F4FC832784FC93B71700A303F4FC26
|
||||
:10127000834774FC138F0700B7170080938F072DE7
|
||||
:101280006B200F007B70FF018327C4FC939727001E
|
||||
:101290000327C4FDB307F70083A607008327C4FC18
|
||||
:1012A00093972700032744FDB307F700032784FD26
|
||||
:1012B0003387E60023A0E700832784FE9387170087
|
||||
:1012C0002324F4FEB7170080138E472D67000E000D
|
||||
:1012D000130000006B300000832744FE9387170043
|
||||
:1012E0002322F4FE832744FE0327C4FEE3E6E7F44B
|
||||
:1012F000130000008320C1040324810413010105AD
|
||||
:1013000067800000130101FC232E1102232C8102AF
|
||||
:1013100013040104232EA4FC232CB4FC232AC4FCB4
|
||||
:101320002328D4FC2326E4FCB76702810327C4FDED
|
||||
:1013300023A4E71EB76702819387871E032784FDD6
|
||||
:1013400023A2E700B76702819387871E032744FD26
|
||||
:1013500023A4E700B76702819387871E0327C4FC95
|
||||
:1013600023A6E700B76702819387871E032704FD42
|
||||
:1013700023A8E700EFE01FE72324A4FE0327C4FC13
|
||||
:10138000832784FEB357F7022326F4FE0327C4FC09
|
||||
:10139000832784FEB377F702638807008327C4FEA0
|
||||
:1013A000938717002326F4FEB76702819387871E71
|
||||
:1013B0000327C4FE23AAE7000327C4FC832784FE77
|
||||
:1013C0006362F702B76702819386871EB7170080B2
|
||||
:1013D0001386C743832584FE032504FDEFF00F88A1
|
||||
:1013E0006F000002B76702819386871EB7170080DF
|
||||
:1013F0001386C7438325C4FC032504FDEFF00F8645
|
||||
:10140000EFE0DFDD2322A4FE032704FD832744FE53
|
||||
:1014100063F8E700032544FEEFF04F936F00C00030
|
||||
:10142000032504FDEFF08F92130000008320C10319
|
||||
:10143000032481031301010467800000130101FBF1
|
||||
:10144000232611042324810413040105232EA4FA66
|
||||
:10145000232CB4FAEFF08F9E2320A4FE832704FEF2
|
||||
:1014600083A70700232EF4FC832704FE83A74700ED
|
||||
:1014700083A70700232CF4FC832704FE83A787009F
|
||||
:10148000232AF4FC832704FE83A747012326F4FEC6
|
||||
:101490000327C4FE8327C4FBB307F7022324F4FE0B
|
||||
:1014A0008327C4FE639A0700930710002326F4FEE7
|
||||
:1014B0008327C4FB2324F4FE832704FE83A7C700ED
|
||||
:1014C0002328F4FC232204FE6F00000B032784FB77
|
||||
:1014D000832704FD3307F702832784FEB307F70051
|
||||
:1014E0002326F4FC032784FE832704FDB337F7008B
|
||||
:1014F00093F7F70F2324F4FC832784FC93B717009A
|
||||
:10150000A303F4FC834774FC138F0700B717008014
|
||||
:10151000938F47566B200F007B70FF018327C4FC1D
|
||||
:10152000939727000327C4FDB307F70083A607009E
|
||||
:101530008327C4FC93972700032744FDB307F700D4
|
||||
:10154000032784FD3387E60223A0E700832784FE78
|
||||
:10155000938717002324F4FEB7170080138E875655
|
||||
:1015600067000E00130000006B300000832744FE6C
|
||||
:10157000938717002322F4FE832744FE0327C4FE2B
|
||||
:10158000E3E6E7F4130000008320C1040324810490
|
||||
:101590001301010567800000130101FD232681026C
|
||||
:1015A00013040103232EA4FC232604FE6F00000174
|
||||
:1015B0008327C4FE938717002326F4FE0327C4FE67
|
||||
:1015C0008327C4FDE346F7FE130000000324C10295
|
||||
:1015D0001301010367800000130101FD232611029E
|
||||
:1015E0002324810213040103232EA4FC232CB4FC26
|
||||
:1015F000B7670281138707208327C4FDB307F7006D
|
||||
:10160000130710002380E7008327C4FD6390070CB5
|
||||
:10161000A30104FE232604FE6F00800A232604FE95
|
||||
:10162000232404FE6F004003B7670281138707205D
|
||||
:10163000832784FEB307F70083C70700638807008A
|
||||
:101640008327C4FE938717002326F4FE832784FE96
|
||||
:10165000938717002324F4FE032784FE832784FD49
|
||||
:10166000E344F7FC0327C4FE832784FD631AF704D1
|
||||
:10167000232204FE6F000004B7670281138707204E
|
||||
:10168000832744FEB307F70023800700B797028142
|
||||
:10169000130710002384E72C13056004EFF0DFEF3D
|
||||
:1016A000B79702812384072C832744FE9387170072
|
||||
:1016B0002322F4FE032744FE832784FDE34EF7FA3A
|
||||
:1016C000834734FEE39C07F46F00400213000000E0
|
||||
:1016D000B797028183C7872C93C7170093F7F70F3B
|
||||
:1016E000E39807FE13054006EFF01FEB1300000020
|
||||
:1016F0008320C102032481021301010367800000DB
|
||||
:10170000130101FF23268100130401019307000048
|
||||
:101710001308000013850700930508000324C10087
|
||||
:101720001301010167800000130101FE232E8100D7
|
||||
:1017300013040102232604FE6F008004B7670281B0
|
||||
:101740000327C4FE1317270093870722B307F70068
|
||||
:101750001307300023A0E700B77702810327C4FEF8
|
||||
:101760001317270093870722B307F70013072000FA
|
||||
:1017700023A0E7008327C4FE938717002326F4FEE7
|
||||
:101780000327C4FE9307F00FE3DAE7FA1300000023
|
||||
:101790000324C1011301010267800000130101FD50
|
||||
:1017A000232611022324810213040103232EA4FC07
|
||||
:1017B000B707008113858711EFF08F80232604FE81
|
||||
:1017C0006F0080058327C4FE638E07008327C4FE55
|
||||
:1017D00093F7F70063980700B70700811385C713D5
|
||||
:1017E000EFE01FFE8327C4FE939727000327C4FD65
|
||||
:1017F000B307F70083A7070013850700EFF00F80FA
|
||||
:10180000B707008113850714EFE09FFB8327C4FE11
|
||||
:10181000938717002326F4FE0327C4FE9307F00FD7
|
||||
:10182000E3D2E7FAB707008113854714EFE05FF9C9
|
||||
:10183000130000008320C10203248102130101036D
|
||||
:1018400067800000130101FF23261100232481007B
|
||||
:1018500013040101EFF05FEDB767028113850722E2
|
||||
:10186000EFF0DFF393070000138507008320C1002A
|
||||
:0C187000032481001301010167800000C7
|
||||
:02000004810079
|
||||
:10000000300000003100000032000000330000002A
|
||||
:10001000340000003500000036000000370000000A
|
||||
:10002000380000003900000061000000620000009C
|
||||
:10003000630000006400000065000000660000002E
|
||||
:100040007761697420666F723A200000466F756EA2
|
||||
:10005000643A20003000000031000000320000004F
|
||||
:1000600033000000340000003500000036000000BE
|
||||
:100070003700000038000000390000006100000077
|
||||
:1000800062000000630000006400000065000000E2
|
||||
:10009000660000000A00000030000000310000008F
|
||||
:1000A0003200000033000000340000003500000082
|
||||
:1000B0003600000037000000380000003900000062
|
||||
:1000C00061000000620000006300000064000000A6
|
||||
:1000D00065000000660000003000000031000000F4
|
||||
:1000E0003200000033000000340000003500000042
|
||||
:1000F0003600000037000000380000003900000022
|
||||
:100100006100000062000000630000006400000065
|
||||
:1001100065000000660000002D2D2D2D2D2D2D2DAC
|
||||
:100120002D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2DFF
|
||||
:100130002D2D2D2D2D2D2D0A000000000A00000070
|
||||
:10014000200000000A2D2D2D2D2D2D2D2D2D2D2D96
|
||||
:100150002D2D2D2D2D2D2D2D2D2D2D2D2D2D2D2DCF
|
||||
:060160002D2D2D2D0A00DB
|
||||
:100168000000008104000081080000810C0000816B
|
||||
:100178001000008114000081180000811C0000811B
|
||||
:100188002000008124000081280000812C000081CB
|
||||
:100198003000008134000081380000813C0000817B
|
||||
:1001A80054000081580000815C00008160000081DB
|
||||
:1001B80064000081680000816C000081700000818B
|
||||
:1001C80074000081780000817C000081800000813B
|
||||
:1001D80084000081880000818C00008190000081EB
|
||||
:1001E800980000819C000081A0000081A40000818B
|
||||
:1001F800A8000081AC000081B0000081B40000813B
|
||||
:10020800B8000081BC000081C0000081C4000081EA
|
||||
:10021800C8000081CC000081D0000081D40000819A
|
||||
:10022800D8000081DC000081E0000081E40000814A
|
||||
:10023800E8000081EC000081F0000081F4000081FA
|
||||
:10024800F8000081FC0000810001008104010081A8
|
||||
:10025800080100810C010081100100811401008156
|
||||
:04026800060000008C
|
||||
:040000058000000077
|
||||
:00000001FF
|
||||
BIN
kernel/vx_include/.DS_Store
vendored
BIN
kernel/vx_include/.DS_Store
vendored
Binary file not shown.
@@ -1,482 +0,0 @@
|
||||
|
||||
#include "vx_front.h"
|
||||
#include "../vx_os/vx_back/vx_back.h"
|
||||
|
||||
// -------------------------- Matrix Multiplication --------------------------
|
||||
|
||||
static mat_mult_arg_t mat_mult_args;
|
||||
|
||||
void _vx_mat_mult(unsigned, unsigned);
|
||||
void vx_sq_mat_mult(void * x, void * y, void * z, unsigned mat_dim)
|
||||
{
|
||||
mat_mult_args.x = x;
|
||||
mat_mult_args.y = y;
|
||||
mat_mult_args.z = z;
|
||||
mat_mult_args.mat_dim = mat_dim;
|
||||
|
||||
unsigned num_avail_threads = vx_available_threads();
|
||||
|
||||
unsigned off = (mat_dim/num_avail_threads);
|
||||
|
||||
if ((mat_dim%num_avail_threads) != 0)
|
||||
{
|
||||
off += 1;
|
||||
}
|
||||
|
||||
// vx_printf("Offset: ", off);
|
||||
|
||||
|
||||
mat_mult_args.offset = off;
|
||||
|
||||
if (mat_dim >= num_avail_threads)
|
||||
{
|
||||
vx_spawnWarps(mat_dim, num_avail_threads, _vx_mat_mult, (void *) (&mat_mult_args));
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_spawnWarps(mat_dim, mat_dim, _vx_mat_mult, (void *) (&mat_mult_args));
|
||||
}
|
||||
|
||||
unsigned num_avail_warps = vx_available_warps();
|
||||
|
||||
if (mat_dim > num_avail_warps)
|
||||
{
|
||||
vx_wait_for_warps(num_avail_warps);
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_wait_for_warps(mat_dim);
|
||||
}
|
||||
}
|
||||
|
||||
void _vx_mat_mult(unsigned tid, unsigned wid)
|
||||
{
|
||||
mat_mult_arg_t * args = (mat_mult_arg_t *) vx_get_arg_struct();
|
||||
|
||||
unsigned * x_ptr = args->x;
|
||||
unsigned * y_ptr = args->y;
|
||||
unsigned * z_ptr = args->z;
|
||||
|
||||
unsigned off = args->offset;
|
||||
|
||||
unsigned i_index = off * tid;
|
||||
|
||||
if (off == 0)
|
||||
{
|
||||
off = 1;
|
||||
i_index = tid;
|
||||
}
|
||||
|
||||
unsigned mat_dim = args->mat_dim;
|
||||
|
||||
for (int iter = 0; iter < off; ++iter)
|
||||
{
|
||||
unsigned total = 0;
|
||||
for (unsigned place = 0; place < mat_dim; ++place)
|
||||
{
|
||||
unsigned x_i = (wid * mat_dim) + place;
|
||||
unsigned y_i = (mat_dim * place ) + i_index;
|
||||
|
||||
total += (x_ptr[x_i] * y_ptr[y_i]);
|
||||
}
|
||||
|
||||
int final_i = (wid * mat_dim) + i_index;
|
||||
// unsigned cond = i_index < mat_dim;
|
||||
// __if(cond)
|
||||
// {
|
||||
z_ptr[final_i] = total;
|
||||
i_index++;
|
||||
// }
|
||||
// __else
|
||||
// __end_if
|
||||
}
|
||||
|
||||
// for (int z = 0; z < ((1000 * wid) + 1000); z++);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static mat_r_arg_t mat_r_args;
|
||||
// -------------------------- Matrix Addition --------------------------
|
||||
void _vx_mat_add(unsigned, unsigned);
|
||||
void vx_mat_add(void * x, void * y, void * z, unsigned num_rows, unsigned num_cols)
|
||||
{
|
||||
mat_r_args.x = x;
|
||||
mat_r_args.y = y;
|
||||
mat_r_args.z = z;
|
||||
mat_r_args.num_cols = num_cols;
|
||||
mat_r_args.num_rows = num_rows;
|
||||
|
||||
|
||||
unsigned num_avail_threads = vx_available_threads();
|
||||
|
||||
unsigned off = (num_cols/num_avail_threads);
|
||||
|
||||
if ((num_cols%num_avail_threads) != 0)
|
||||
{
|
||||
off += 1;
|
||||
}
|
||||
|
||||
|
||||
mat_r_args.offset = off;
|
||||
|
||||
if (num_cols >= num_avail_threads)
|
||||
{
|
||||
vx_spawnWarps(num_rows, num_avail_threads, _vx_mat_add, (void *) (&mat_r_args));
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_spawnWarps(num_rows, num_cols, _vx_mat_add, (void *) (&mat_r_args));
|
||||
}
|
||||
|
||||
unsigned num_avail_warps = vx_available_warps();
|
||||
|
||||
if (num_rows > num_avail_warps)
|
||||
{
|
||||
vx_wait_for_warps(num_avail_warps);
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_wait_for_warps(num_rows);
|
||||
}
|
||||
}
|
||||
|
||||
void _vx_mat_add(unsigned tid, unsigned wid)
|
||||
{
|
||||
// vx_print_str("*");
|
||||
// for (int z = 0; z < ((wid * 1000) + 1000); z++);
|
||||
|
||||
mat_r_arg_t * args = (mat_r_arg_t *) vx_get_arg_struct();
|
||||
|
||||
unsigned * x_ptr = args->x;
|
||||
unsigned * y_ptr = args->y;
|
||||
unsigned * z_ptr = args->z;
|
||||
|
||||
unsigned off = args->offset;
|
||||
|
||||
unsigned i_index = off * tid;
|
||||
|
||||
if (off == 0)
|
||||
{
|
||||
off = 1;
|
||||
i_index = tid;
|
||||
}
|
||||
|
||||
unsigned num_cols = args->num_cols;
|
||||
|
||||
for (int iter = 0; iter < off; ++iter)
|
||||
{
|
||||
int final_i = (wid * num_cols) + i_index;
|
||||
unsigned cond = i_index < num_cols;
|
||||
__if(cond)
|
||||
{
|
||||
z_ptr[final_i] = x_ptr[final_i] + y_ptr[final_i];
|
||||
i_index++;
|
||||
}
|
||||
__else
|
||||
__end_if
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------- Matrix Subtraction --------------------------
|
||||
void _vx_mat_sub(unsigned, unsigned);
|
||||
void vx_mat_sub(void * x, void * y, void * z, unsigned num_rows, unsigned num_cols)
|
||||
{
|
||||
mat_r_args.x = x;
|
||||
mat_r_args.y = y;
|
||||
mat_r_args.z = z;
|
||||
mat_r_args.num_cols = num_cols;
|
||||
mat_r_args.num_rows = num_rows;
|
||||
|
||||
unsigned num_avail_threads = vx_available_threads();
|
||||
|
||||
unsigned off = (num_cols/num_avail_threads);
|
||||
|
||||
if ((num_cols%num_avail_threads) != 0)
|
||||
{
|
||||
off += 1;
|
||||
}
|
||||
|
||||
|
||||
mat_r_args.offset = off;
|
||||
|
||||
if (num_cols >= num_avail_threads)
|
||||
{
|
||||
vx_spawnWarps(num_rows, num_avail_threads, _vx_mat_sub, (void *) (&mat_r_args));
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_spawnWarps(num_rows, num_cols, _vx_mat_sub, (void *) (&mat_r_args));
|
||||
}
|
||||
|
||||
unsigned num_avail_warps = vx_available_warps();
|
||||
|
||||
if (num_rows > num_avail_warps)
|
||||
{
|
||||
vx_wait_for_warps(num_avail_warps);
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_wait_for_warps(num_rows);
|
||||
}
|
||||
}
|
||||
|
||||
void _vx_mat_sub(unsigned tid, unsigned wid)
|
||||
{
|
||||
// vx_print_str("*");
|
||||
// for (int z = 0; z < ((wid * 1000) + 1000); z++);
|
||||
|
||||
mat_r_arg_t * args = (mat_r_arg_t *) vx_get_arg_struct();
|
||||
|
||||
unsigned * x_ptr = args->x;
|
||||
unsigned * y_ptr = args->y;
|
||||
unsigned * z_ptr = args->z;
|
||||
|
||||
unsigned off = args->offset;
|
||||
|
||||
unsigned i_index = off * tid;
|
||||
|
||||
if (off == 0)
|
||||
{
|
||||
off = 1;
|
||||
i_index = tid;
|
||||
}
|
||||
|
||||
unsigned num_cols = args->num_cols;
|
||||
|
||||
for (int iter = 0; iter < off; ++iter)
|
||||
{
|
||||
int final_i = (wid * num_cols) + i_index;
|
||||
unsigned cond = i_index < num_cols;
|
||||
__if(cond)
|
||||
{
|
||||
z_ptr[final_i] = x_ptr[final_i] - y_ptr[final_i];
|
||||
i_index++;
|
||||
}
|
||||
__else
|
||||
__end_if
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static mat_e_arg_t mat_e_args;
|
||||
// --------------------------------------------------------------
|
||||
|
||||
void _vx_e_mat_add(unsigned, unsigned);
|
||||
void vx_e_mat_add(void * x, void * scal, void * z, unsigned num_rows, unsigned num_cols)
|
||||
{
|
||||
mat_e_args.x = x;
|
||||
mat_e_args.scal = scal;
|
||||
mat_e_args.z = z;
|
||||
mat_e_args.num_cols = num_cols;
|
||||
mat_e_args.num_rows = num_rows;
|
||||
|
||||
|
||||
unsigned num_avail_threads = vx_available_threads();
|
||||
|
||||
unsigned off = (num_cols/num_avail_threads);
|
||||
|
||||
if ((num_cols%num_avail_threads) != 0)
|
||||
{
|
||||
off += 1;
|
||||
}
|
||||
|
||||
mat_e_args.offset = off;
|
||||
|
||||
if (num_cols >= num_avail_threads)
|
||||
{
|
||||
vx_spawnWarps(num_rows, num_avail_threads, _vx_e_mat_add, (void *) (&mat_e_args));
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_spawnWarps(num_rows, num_cols, _vx_e_mat_add, (void *) (&mat_e_args));
|
||||
}
|
||||
|
||||
unsigned num_avail_warps = vx_available_warps();
|
||||
|
||||
if (num_rows > num_avail_warps)
|
||||
{
|
||||
vx_wait_for_warps(num_avail_warps);
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_wait_for_warps(num_rows);
|
||||
}
|
||||
}
|
||||
|
||||
void _vx_e_mat_add(unsigned tid, unsigned wid)
|
||||
{
|
||||
// vx_print_str("*");
|
||||
// for (int z = 0; z < ((wid * 1000) + 1000); z++);
|
||||
|
||||
mat_e_arg_t * args = (mat_e_arg_t *) vx_get_arg_struct();
|
||||
|
||||
unsigned * x_ptr = args->x;
|
||||
unsigned scal = *((unsigned *) args->scal);
|
||||
|
||||
unsigned * z_ptr = args->z;
|
||||
|
||||
unsigned off = args->offset;
|
||||
|
||||
unsigned i_index = off * tid;
|
||||
|
||||
if (off == 0)
|
||||
{
|
||||
off = 1;
|
||||
i_index = tid;
|
||||
}
|
||||
|
||||
unsigned num_cols = args->num_cols;
|
||||
|
||||
for (int iter = 0; iter < off; ++iter)
|
||||
{
|
||||
int final_i = (wid * num_cols) + i_index;
|
||||
unsigned cond = i_index < num_cols;
|
||||
__if(cond)
|
||||
{
|
||||
z_ptr[final_i] = x_ptr[final_i] + scal;
|
||||
i_index++;
|
||||
}
|
||||
__else
|
||||
__end_if
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void _vx_e_mat_mult(unsigned, unsigned);
|
||||
void vx_e_mat_mult(void * x, void * scal, void * z, unsigned num_rows, unsigned num_cols)
|
||||
{
|
||||
mat_e_args.x = x;
|
||||
mat_e_args.scal = scal;
|
||||
mat_e_args.z = z;
|
||||
mat_e_args.num_cols = num_cols;
|
||||
mat_e_args.num_rows = num_rows;
|
||||
|
||||
|
||||
unsigned num_avail_threads = vx_available_threads();
|
||||
|
||||
unsigned off = (num_cols/num_avail_threads);
|
||||
|
||||
if ((num_cols%num_avail_threads) != 0)
|
||||
{
|
||||
off += 1;
|
||||
}
|
||||
|
||||
mat_e_args.offset = off;
|
||||
|
||||
if (num_cols >= num_avail_threads)
|
||||
{
|
||||
vx_spawnWarps(num_rows, num_avail_threads, _vx_e_mat_mult, (void *) (&mat_e_args));
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_spawnWarps(num_rows, num_cols, _vx_e_mat_mult, (void *) (&mat_e_args));
|
||||
}
|
||||
|
||||
unsigned num_avail_warps = vx_available_warps();
|
||||
|
||||
if (num_rows > num_avail_warps)
|
||||
{
|
||||
vx_wait_for_warps(num_avail_warps);
|
||||
}
|
||||
else
|
||||
{
|
||||
vx_wait_for_warps(num_rows);
|
||||
}
|
||||
}
|
||||
|
||||
void _vx_e_mat_mult(unsigned tid, unsigned wid)
|
||||
{
|
||||
// vx_print_str("*");
|
||||
// for (int z = 0; z < ((wid * 1000) + 1000); z++);
|
||||
|
||||
mat_e_arg_t * args = (mat_e_arg_t *) vx_get_arg_struct();
|
||||
|
||||
unsigned * x_ptr = args->x;
|
||||
unsigned scal = *((unsigned *) args->scal);
|
||||
|
||||
unsigned * z_ptr = args->z;
|
||||
|
||||
unsigned off = args->offset;
|
||||
|
||||
unsigned i_index = off * tid;
|
||||
|
||||
if (off == 0)
|
||||
{
|
||||
off = 1;
|
||||
i_index = tid;
|
||||
}
|
||||
|
||||
unsigned num_cols = args->num_cols;
|
||||
|
||||
for (int iter = 0; iter < off; ++iter)
|
||||
{
|
||||
int final_i = (wid * num_cols) + i_index;
|
||||
unsigned cond = i_index < num_cols;
|
||||
__if(cond)
|
||||
{
|
||||
z_ptr[final_i] = x_ptr[final_i] * scal;
|
||||
i_index++;
|
||||
}
|
||||
__else
|
||||
__end_if
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void sleep(int num)
|
||||
{
|
||||
for (int i = 0; i < num; i++);
|
||||
}
|
||||
|
||||
|
||||
bool barrier_bool = false;
|
||||
bool barriers[32];
|
||||
|
||||
void barrier(unsigned wid, int num)
|
||||
{
|
||||
barriers[wid] = true;
|
||||
|
||||
if (wid == 0)
|
||||
{
|
||||
bool cont = false;
|
||||
int count = 0;
|
||||
while(cont)
|
||||
{
|
||||
count = 0;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
if (barriers[i]) count++;
|
||||
}
|
||||
|
||||
if (count == num)
|
||||
{
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
barriers[i] = false;
|
||||
barrier_bool = true;
|
||||
sleep(70);
|
||||
barrier_bool = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(!barrier_bool);
|
||||
sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#include "../vx_os/vx_back/vx_back.h"
|
||||
#include "../vx_os/vx_io/vx_io.h"
|
||||
|
||||
|
||||
// -------------------------- Matrix Multiplication --------------------------
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * x;
|
||||
void * y;
|
||||
void * z;
|
||||
unsigned mat_dim;
|
||||
unsigned offset;
|
||||
|
||||
} mat_mult_arg_t;
|
||||
void vx_sq_mat_mult(void *, void *, void *, unsigned);
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * x;
|
||||
void * y;
|
||||
void * z;
|
||||
unsigned num_cols;
|
||||
unsigned num_rows;
|
||||
unsigned offset;
|
||||
|
||||
} mat_r_arg_t;
|
||||
// -------------------------- Matrix Addition -----------------------------
|
||||
void vx_mat_add(void *, void *, void *, unsigned, unsigned);
|
||||
|
||||
// -------------------------- Matrix Subtraction --------------------------
|
||||
void vx_mat_sub(void *, void *, void *, unsigned, unsigned);
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
typedef struct
|
||||
{
|
||||
void * x;
|
||||
void * scal;
|
||||
void * z;
|
||||
unsigned num_cols;
|
||||
unsigned num_rows;
|
||||
unsigned offset;
|
||||
|
||||
} mat_e_arg_t;
|
||||
|
||||
// -------------------------- Matrix element Addition ------------------
|
||||
void vx_e_mat_add(void *, void *, void *, unsigned, unsigned);
|
||||
|
||||
// -------------------------- Matrix element Addition ------------------
|
||||
void vx_e_mat_mult(void *, void *, void *, unsigned, unsigned);
|
||||
@@ -1,40 +0,0 @@
|
||||
|
||||
#include "vx_mem.h"
|
||||
|
||||
|
||||
void * vx_malloc_shared(unsigned size)
|
||||
{
|
||||
void * to_return;
|
||||
|
||||
bool done = false;
|
||||
unsigned curr_size;
|
||||
|
||||
unsigned curr_index = 0;
|
||||
while ((curr_index < free_index) && !done)
|
||||
{
|
||||
curr_size = (unsigned) *(free_array[curr_index].ptr - 4);
|
||||
if (curr_size <= size)
|
||||
{
|
||||
to_return = free_array[curr_index].ptr;
|
||||
done = true;
|
||||
}
|
||||
|
||||
curr_index++;
|
||||
}
|
||||
|
||||
unsigned * u_heap_ptr = (unsigned *) heap_ptr;
|
||||
|
||||
if (!done)
|
||||
{
|
||||
u_heap_ptr[0] = size;
|
||||
to_return = heap_ptr + 4;
|
||||
heap_ptr = to_return + size;
|
||||
}
|
||||
|
||||
return to_return;
|
||||
}
|
||||
|
||||
void vx_free(void * to_free)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
void * vx_malloc_shared(unsigned);
|
||||
void vx_free(void *);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * ptr;
|
||||
|
||||
} free_t;
|
||||
|
||||
void * heap_ptr = (void *) 0xFF000000;
|
||||
|
||||
free_t free_array[100];
|
||||
unsigned free_index = 0;
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
|
||||
#include "./vx_include/vx_front.h"
|
||||
|
||||
unsigned x[1024] = {0};
|
||||
unsigned y[1024] = {0};
|
||||
unsigned z[1024] = {0};
|
||||
|
||||
unsigned temp = 6;
|
||||
|
||||
#define MAT_DIM 16
|
||||
|
||||
#define NUM_COLS 16
|
||||
#define NUM_ROWS 16
|
||||
|
||||
double sc_time_stamp()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void initialize_mats()
|
||||
{
|
||||
for (int i = 0; i < (MAT_DIM * MAT_DIM); i++)
|
||||
{
|
||||
x[i] = 3;
|
||||
y[i] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void print_matrix(unsigned * z)
|
||||
{
|
||||
vx_print_str("-------------------------------\n");
|
||||
for (int j = 0; j < (MAT_DIM * MAT_DIM); j++)
|
||||
{
|
||||
if (j!=0) if ((j % MAT_DIM) == 0) vx_print_str("\n");
|
||||
vx_print_hex(z[j]);
|
||||
vx_print_str(" ");
|
||||
}
|
||||
vx_print_str("\n-------------------------------\n");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
// unsigned f = temp;
|
||||
|
||||
// vx_print_hex(11);
|
||||
// vx_printc(0, 'k');
|
||||
|
||||
initialize_mats();
|
||||
|
||||
// matrix multiplication
|
||||
// vx_sq_mat_mult(x, y, z, MAT_DIM);
|
||||
// vx_print_str("\n\nMatrix multiplication\n");
|
||||
// print_matrix(z);
|
||||
|
||||
print_matrix(x);
|
||||
|
||||
// // matrix addition
|
||||
// vx_mat_add(x, y, z, NUM_ROWS, NUM_COLS);
|
||||
// vx_print_str("\n\nMatrix Addition\n");
|
||||
// print_matrix(z);
|
||||
|
||||
|
||||
// // matrix sub
|
||||
// vx_mat_sub(x, y, z, NUM_ROWS, NUM_COLS);
|
||||
// vx_print_str("\n\nMatrix Subtraction\n");
|
||||
// print_matrix(z);
|
||||
|
||||
// unsigned scal = 3;
|
||||
|
||||
// // matrix element add
|
||||
vx_e_mat_add(z, &scal, z, NUM_ROWS, NUM_COLS);
|
||||
// vx_print_str("\n\nMatrix Element Addition\n");
|
||||
// print_matrix(z);
|
||||
|
||||
// // matrix element add
|
||||
// vx_e_mat_mult(z, &scal, z, NUM_ROWS, NUM_COLS);
|
||||
// vx_print_str("\n\nMatrix Element Addition\n");
|
||||
// print_matrix(z);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
kernel/vx_os/.DS_Store
vendored
BIN
kernel/vx_os/.DS_Store
vendored
Binary file not shown.
@@ -1,153 +0,0 @@
|
||||
|
||||
#include "vx_back.h"
|
||||
#include "../vx_io/vx_io.h"
|
||||
|
||||
|
||||
void vx_before_main()
|
||||
{
|
||||
// unsigned num_available_warps = vx_available_warps();
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
queue_initialize(q + i);
|
||||
}
|
||||
}
|
||||
|
||||
void vx_reschedule_warps()
|
||||
{
|
||||
|
||||
register unsigned curr_warp asm("s10");
|
||||
// vx_printf("Reschedule: ", curr_warp);
|
||||
asm __volatile__("nop");
|
||||
|
||||
if (queue_isEmpty(q+curr_warp))
|
||||
{
|
||||
// vx_printf("Done: ", curr_warp);
|
||||
done[curr_warp] = 1;
|
||||
if (curr_warp == 0)
|
||||
{
|
||||
vx_load_context();
|
||||
return;
|
||||
}
|
||||
ECALL;
|
||||
}
|
||||
|
||||
Job j;
|
||||
queue_dequeue(q+curr_warp,&j);
|
||||
|
||||
// vx_printf("Reschedule -> ", j.wid);
|
||||
asm __volatile__("mv sp,%0"::"r" (j.base_sp):);
|
||||
vx_createThreads(j.n_threads, j.wid, j.func_ptr, j.args, j.assigned_warp);
|
||||
|
||||
ECALL; // should never reach this
|
||||
|
||||
}
|
||||
|
||||
void vx_schedule_warps()
|
||||
{
|
||||
|
||||
unsigned num_available_warps = vx_available_warps();
|
||||
|
||||
asm __volatile__("mv s3, sp");
|
||||
|
||||
for (int curr_warp = 1; curr_warp < num_available_warps; ++curr_warp)
|
||||
{
|
||||
if (!queue_isEmpty(q+curr_warp))
|
||||
{
|
||||
Job j;
|
||||
queue_dequeue(q+curr_warp,&j);
|
||||
asm __volatile__("mv sp,%0"::"r" (j.base_sp):);
|
||||
vx_wspawn(j.n_threads, j.wid, j.func_ptr, j.args, j.assigned_warp);
|
||||
}
|
||||
}
|
||||
|
||||
asm __volatile__("mv sp, s3");
|
||||
|
||||
|
||||
vx_save_context();
|
||||
|
||||
// vx_print_str("saved context\n");
|
||||
|
||||
register unsigned val asm("tp");
|
||||
if (val)
|
||||
{
|
||||
if (!queue_isEmpty(q))
|
||||
{
|
||||
// vx_print_str("found something for w0\n");
|
||||
Job j;
|
||||
queue_dequeue(q,&j);
|
||||
// vx_printf("num_threads: ", j.n_threads);
|
||||
asm __volatile__("mv sp,%0"::"r" (j.base_sp):);
|
||||
vx_createThreads(j.n_threads, j.wid, j.func_ptr, j.args, j.assigned_warp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void vx_spawnWarps(unsigned num_Warps, unsigned num_threads, FUNC, void * args)
|
||||
{
|
||||
vx_before_main();
|
||||
|
||||
unsigned num_available_warps = vx_available_warps();
|
||||
// vx_printf("Num available warps: ", num_available_warps);
|
||||
|
||||
asm __volatile__("addi s2, sp, 0");
|
||||
int warp = 0;
|
||||
for (unsigned i = 0; i < num_Warps; i++)
|
||||
{
|
||||
asm __volatile__("lui s3, 0xFFFF0");
|
||||
asm __volatile__("add sp, sp, s3");
|
||||
register unsigned stack_ptr asm("sp");
|
||||
|
||||
Job j;
|
||||
j.wid = i;
|
||||
j.n_threads = num_threads;
|
||||
j.base_sp = stack_ptr;
|
||||
j.func_ptr = (unsigned) func;
|
||||
j.args = args;
|
||||
j.assigned_warp = warp;
|
||||
|
||||
queue_enqueue(q + warp,&j);
|
||||
++warp;
|
||||
if (warp >= num_available_warps) warp = 0;
|
||||
}
|
||||
asm __volatile__("addi sp, s2, 0");
|
||||
|
||||
|
||||
vx_schedule_warps();
|
||||
|
||||
}
|
||||
|
||||
void vx_wait_for_warps(unsigned num_wait)
|
||||
{
|
||||
vx_printf("wait for: ", num_wait);
|
||||
unsigned num_available_warps = vx_available_warps();
|
||||
unsigned num = 0;
|
||||
while (num < num_wait)
|
||||
{
|
||||
// change num=1 if running on RTL
|
||||
// Change num=0 if running on emulator
|
||||
num = 1;
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
if (done[i] == 1)
|
||||
{
|
||||
num += 1;
|
||||
}
|
||||
}
|
||||
vx_printf("Found: ", num);
|
||||
}
|
||||
|
||||
// vx_printf("num found: ", num);
|
||||
for (int i = 0; i < num_available_warps; i++) done[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
void * vx_get_arg_struct(void)
|
||||
{
|
||||
register void *ret asm("s7");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "../vx_util/queue.h"
|
||||
|
||||
#define WSPAWN asm __volatile__(".word 0x3006b"::);
|
||||
#define CLONE asm __volatile__(".word 0x3506b":::);
|
||||
#define JALRS asm __volatile__(".word 0x1bfe0eb":::"s10");
|
||||
#define ECALL asm __volatile__(".word 0x00000073");
|
||||
#define JMPRT asm __volatile__(".word 0x5406b");
|
||||
#define SPLIT asm __volatile__(".word 0xf206b");
|
||||
#define P_JUMP asm __volatile__(".word 0x1ff707b");
|
||||
#define JOIN asm __volatile__(".word 0x306b");
|
||||
|
||||
|
||||
#define __if(val) bool temp = !val; \
|
||||
register unsigned p asm("t5") = temp; \
|
||||
register void * e asm("t6") = &&ELSE; \
|
||||
SPLIT; \
|
||||
P_JUMP; \
|
||||
|
||||
|
||||
#define __else register void * w asm("t3") = &&AFTER; \
|
||||
asm __volatile__("jr t3"); \
|
||||
ELSE: asm __volatile__("nop");
|
||||
|
||||
#define __end_if AFTER:\
|
||||
JOIN;
|
||||
|
||||
static int done[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
static int main_sp[1];
|
||||
|
||||
unsigned context[64];
|
||||
void vx_save_context(void);
|
||||
void vx_load_context(void);
|
||||
|
||||
|
||||
#define FUNC void (func)(unsigned, unsigned)
|
||||
|
||||
unsigned vx_available_warps(void);
|
||||
unsigned vx_available_threads(void);
|
||||
|
||||
|
||||
void vx_createThreads(unsigned, unsigned, unsigned, void *, unsigned);
|
||||
void vx_wspawn(unsigned, unsigned, unsigned, void *, unsigned);
|
||||
void vx_spawnWarps(unsigned num_Warps, unsigned num_threads, FUNC, void *);
|
||||
void vx_schedule_warps(void);
|
||||
void vx_reschedule_warps(void);
|
||||
void vx_wait_for_warps(unsigned);
|
||||
void * vx_get_arg_struct(void);
|
||||
|
||||
|
||||
@@ -1,232 +0,0 @@
|
||||
|
||||
|
||||
|
||||
.section .text
|
||||
|
||||
.type _start, @function
|
||||
.global _start
|
||||
_start:
|
||||
# li a1, 4
|
||||
# add a2, a1, a1
|
||||
# li a0, 0
|
||||
# .word 0x0005006b # tmc a0
|
||||
###########################
|
||||
# la a0, 0x10000000
|
||||
# li a1, 7
|
||||
# sw a1, 0(a0)
|
||||
|
||||
# la a0, 0x10000048
|
||||
# li a1, 3
|
||||
# sw a1, 0(a0)
|
||||
|
||||
# la a0, 0x80000000
|
||||
# li a1, 9
|
||||
# sw a1, 0(a0)
|
||||
|
||||
# la a0, 0x80000008
|
||||
# li a1, 8
|
||||
# sw a1, 0(a0)
|
||||
|
||||
# la a0, 0x10000000
|
||||
# lw a2, 0(a0)
|
||||
# la a0, 0x10000048
|
||||
# lw a3, 0(a0)
|
||||
# li a0, 0
|
||||
# .word 0x0005006b # tmc a0
|
||||
########################################
|
||||
# li a0, 4
|
||||
# la a1, SPAWN
|
||||
# .word 0x00b5106b # wspawn a0(numWarps), a1(PC SPAWN)
|
||||
# j SPAWN
|
||||
# nop
|
||||
# nop
|
||||
# nop
|
||||
# nop
|
||||
# nop
|
||||
# nop
|
||||
# nop
|
||||
# nop
|
||||
# SPAWN:
|
||||
# li a2, 7
|
||||
# li a0, 0
|
||||
# li a1, 4
|
||||
# .word 0x00b5406b # barrier a0(barrier id), a1(numWarps)
|
||||
# .word 0x0005006b # tmc a0
|
||||
##########################
|
||||
# li a0, 4
|
||||
# .word 0x0005006b # tmc a0
|
||||
#
|
||||
# # csrr a2, 0x21 # read warp IDs
|
||||
# slti a0, a1, 2
|
||||
# .word 0x0005206b # split a0
|
||||
# beq a0, zero, ELSE
|
||||
# li a2, 5
|
||||
# j DONE
|
||||
# ELSE:
|
||||
# li a2, 7
|
||||
# DONE:
|
||||
# .word 0x0000306b #join
|
||||
# ecall
|
||||
############################
|
||||
lui sp, 0x7ffff
|
||||
# jal vx_before_main
|
||||
jal main
|
||||
li a0, 0
|
||||
.word 0x0005006b # tmc a0
|
||||
|
||||
# Hi:
|
||||
# li a2, 7
|
||||
# ret
|
||||
|
||||
.type vx_createThreads, @function
|
||||
.global vx_createThreads
|
||||
vx_createThreads:
|
||||
mv s7 ,a3 # Moving args to s7
|
||||
mv s10,a4 # Moving assigned_warp to s10
|
||||
mv t5 ,sp # Saving the current stack pointer to t5
|
||||
mv t2 , a0 # t2 = num_threads
|
||||
loop_init:
|
||||
li a0,1 # i = 0
|
||||
loop_cond:
|
||||
bge a0, t2, loop_done # i < num_threads
|
||||
loop_body:
|
||||
addi sp,sp,-2048 # Allocate 2k stack for new thread
|
||||
mv t1, a0 # #lane = i
|
||||
.word 0x3506b # clone register state
|
||||
loop_inc:
|
||||
addi a0, a0, 1
|
||||
j loop_cond
|
||||
loop_done:
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
mv sp,t5 # Restoring the stack
|
||||
li a0,0 # setting tid = 0 for main thread
|
||||
mv t6,a2 # setting func_addr
|
||||
mv s11,t2 # setting num_threads to spawn
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
.word 0x1bfe0eb
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
la a0, vx_reschedule_warps
|
||||
.word 0x5406b
|
||||
|
||||
|
||||
.type vx_wspawn, @function
|
||||
.global vx_wspawn
|
||||
vx_wspawn:
|
||||
la t1, vx_createThreads
|
||||
.word 0x3006b # WSPAWN instruction
|
||||
ret
|
||||
|
||||
.global context
|
||||
|
||||
.type vx_save_context, @function
|
||||
.global vx_save_context
|
||||
vx_save_context:
|
||||
la tp, context
|
||||
sw x0 , 0 (tp)
|
||||
sw x1 , 4 (tp)
|
||||
sw x2 , 8 (tp)
|
||||
sw x3 , 12(tp)
|
||||
sw x4 , 16(tp)
|
||||
sw x5 , 20(tp)
|
||||
sw x6 , 24(tp)
|
||||
sw x7 , 28(tp)
|
||||
sw x8 , 32(tp)
|
||||
sw x9 , 36(tp)
|
||||
sw x10, 40(tp)
|
||||
sw x11, 44(tp)
|
||||
sw x12, 48(tp)
|
||||
sw x13, 52(tp)
|
||||
sw x14, 56(tp)
|
||||
sw x15, 60(tp)
|
||||
sw x16, 64(tp)
|
||||
sw x17, 68(tp)
|
||||
sw x18, 72(tp)
|
||||
sw x19, 76(tp)
|
||||
sw x20, 80(tp)
|
||||
sw x21, 84(tp)
|
||||
sw x22, 88(tp)
|
||||
sw x23, 92(tp)
|
||||
sw x24, 96(tp)
|
||||
sw x25, 100(tp)
|
||||
sw x26, 104(tp)
|
||||
sw x27, 108(tp)
|
||||
sw x28, 112(tp)
|
||||
sw x29, 116(tp)
|
||||
sw x30, 120(tp)
|
||||
sw x31, 124(tp)
|
||||
li tp, 1
|
||||
ret
|
||||
|
||||
|
||||
.type vx_load_context, @function
|
||||
.global vx_load_context
|
||||
vx_load_context:
|
||||
la tp, context
|
||||
lw x0 , 0 (tp)
|
||||
lw x1 , 4 (tp)
|
||||
lw x2 , 8 (tp)
|
||||
lw x3 , 12(tp)
|
||||
lw x4 , 16(tp)
|
||||
lw x5 , 20(tp)
|
||||
lw x6 , 24(tp)
|
||||
lw x7 , 28(tp)
|
||||
lw x8 , 32(tp)
|
||||
lw x9 , 36(tp)
|
||||
lw x10, 40(tp)
|
||||
lw x11, 44(tp)
|
||||
lw x12, 48(tp)
|
||||
lw x13, 52(tp)
|
||||
lw x14, 56(tp)
|
||||
lw x15, 60(tp)
|
||||
lw x16, 64(tp)
|
||||
lw x17, 68(tp)
|
||||
lw x18, 72(tp)
|
||||
lw x19, 76(tp)
|
||||
lw x20, 80(tp)
|
||||
lw x21, 84(tp)
|
||||
lw x22, 88(tp)
|
||||
lw x23, 92(tp)
|
||||
lw x24, 96(tp)
|
||||
lw x25, 100(tp)
|
||||
lw x26, 104(tp)
|
||||
lw x27, 108(tp)
|
||||
lw x28, 112(tp)
|
||||
lw x29, 116(tp)
|
||||
lw x30, 120(tp)
|
||||
lw x31, 124(tp)
|
||||
li tp, 0
|
||||
ret
|
||||
|
||||
.type vx_available_warps, @function
|
||||
.global vx_available_warps
|
||||
vx_available_warps:
|
||||
csrr a0, 0x20
|
||||
ret
|
||||
|
||||
.type vx_available_threads, @function
|
||||
.global vx_available_threads
|
||||
vx_available_threads:
|
||||
csrr a0, 0x21
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
kernel/vx_os/vx_io/.DS_Store
vendored
BIN
kernel/vx_os/vx_io/.DS_Store
vendored
Binary file not shown.
@@ -1,15 +0,0 @@
|
||||
|
||||
#include "vx_io.h"
|
||||
|
||||
void vx_print_hex(unsigned f)
|
||||
{
|
||||
vx_print_str(hextoa[f]);
|
||||
}
|
||||
|
||||
|
||||
void vx_printf(char * c, unsigned f)
|
||||
{
|
||||
vx_print_str(c);
|
||||
vx_print_hex(f);
|
||||
vx_print_str("\n");
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
static char * hextoa[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
|
||||
void vx_print_hex(unsigned);
|
||||
void vx_print_str(char *);
|
||||
void vx_printf(char *, unsigned);
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
|
||||
.type vx_print_str, @function
|
||||
.global vx_print_str
|
||||
vx_print_str:
|
||||
addi sp, sp, -12
|
||||
sw ra, 0(sp)
|
||||
sw a1, 4(sp)
|
||||
bl:
|
||||
lbu a1,0(a0)
|
||||
beqz a1,be
|
||||
jal vx_printc
|
||||
addi a0, a0, 1
|
||||
j bl
|
||||
be:
|
||||
lw ra, 0(sp)
|
||||
lw a1, 4(sp)
|
||||
addi sp, sp, 12
|
||||
ret
|
||||
|
||||
|
||||
.type vx_printc, @function
|
||||
.global vx_printc
|
||||
vx_printc:
|
||||
la a7, 0x00010000
|
||||
sw a1, 0(a7)
|
||||
ret
|
||||
|
||||
|
||||
|
||||
BIN
kernel/vx_os/vx_util/.DS_Store
vendored
BIN
kernel/vx_os/vx_util/.DS_Store
vendored
Binary file not shown.
@@ -1,49 +0,0 @@
|
||||
|
||||
#ifndef __QUEUE__
|
||||
|
||||
#define __QUEUE__
|
||||
|
||||
|
||||
|
||||
#define SIZE 100
|
||||
#define WARPS 8
|
||||
|
||||
|
||||
typedef struct Job_t
|
||||
{
|
||||
unsigned wid;
|
||||
unsigned n_threads;
|
||||
unsigned base_sp;
|
||||
unsigned func_ptr;
|
||||
void * args;
|
||||
unsigned assigned_warp;
|
||||
|
||||
} Job;
|
||||
|
||||
typedef struct Queue_t
|
||||
{
|
||||
unsigned start_i;
|
||||
unsigned end_i;
|
||||
unsigned num_j;
|
||||
unsigned total_warps;
|
||||
unsigned active_warps;
|
||||
struct Job_t jobs[SIZE];
|
||||
|
||||
} Queue;
|
||||
|
||||
Queue q[64];
|
||||
|
||||
void queue_initialize(Queue *);
|
||||
|
||||
void queue_enqueue(Queue *, Job *);
|
||||
|
||||
void queue_dequeue(Queue *, Job *);
|
||||
|
||||
int queue_isFull(Queue *);
|
||||
int queue_isEmpty(Queue *);
|
||||
int queue_availableWarps(Queue *);
|
||||
|
||||
|
||||
void func();
|
||||
|
||||
#endif
|
||||
@@ -1,129 +0,0 @@
|
||||
|
||||
.equ A_WARPS, 7
|
||||
.equ SIZE, 50
|
||||
|
||||
.section .text
|
||||
|
||||
.type queue_initialize, @function
|
||||
.global queue_initialize
|
||||
queue_initialize:
|
||||
mv t0, a0 # loading base address of q
|
||||
li t1, 0 # to initialize variables
|
||||
li t2, A_WARPS # Num of available warps
|
||||
sw t1, 0 (t0) # start_i
|
||||
sw t1, 4 (t0) # end_i
|
||||
sw t1, 8 (t0) # num_j
|
||||
sw t2, 12(t0) # total_warps
|
||||
sw t1, 16(t0) # active_warps
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
.type queue_enqueue, @function
|
||||
.global queue_enqueue
|
||||
queue_enqueue:
|
||||
mv t0, a0 # loding base address of q
|
||||
lw t1, 8 (t0) # t1 = num_j
|
||||
addi t1, t1, 1 # ++t1
|
||||
sw t1, 8 (t0) # num_j = t1
|
||||
addi t1, t0, 20 # t1 = jobs_addr
|
||||
lw t4, 4 (t0) # t4 = end_i
|
||||
slli t2, t4, 5 # index * 32 [log(sizeof(job))]
|
||||
add t1, t1, t2 # jobs + index
|
||||
lw t3, 0 (a1) # wid
|
||||
sw t3, 0 (t1) #
|
||||
lw t3, 4 (a1) # n_threads
|
||||
sw t3, 4 (t1) #
|
||||
lw t3, 8 (a1) # base_sp
|
||||
sw t3, 8 (t1) #
|
||||
lw t3, 12(a1) # func_ptr
|
||||
sw t3, 12(t1) #
|
||||
lw t3, 16(a1) # args
|
||||
sw t3, 16(t1) #
|
||||
lw t3, 20(a1) # assigned_warp
|
||||
sw t3, 20(t1) #
|
||||
addi t4, t4, 1 # end_i++
|
||||
li t5, SIZE # size
|
||||
bne t4, t5, ec # if ((q.end_i + 1) == SIZE)
|
||||
mv t4, zero
|
||||
ec:
|
||||
sw t4, 4 (t0) # end_i
|
||||
ret
|
||||
|
||||
|
||||
.type queue_dequeue, @function
|
||||
.global queue_dequeue
|
||||
|
||||
queue_dequeue:
|
||||
mv t0, a0 # loading base address of q
|
||||
lw t1, 8 (t0) # t1 = num_j
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
addi t1, t1, -1 # --t1
|
||||
sw t1, 8 (t0) # num_j = t1
|
||||
addi t1, t0, 20 # t1 = jobs_addr
|
||||
lw t4, 0 (t0) # t4 = start_i
|
||||
li t6, SIZE # size
|
||||
mv t5, t4 # t5 = start_i
|
||||
addi t5, t5, 1 # t5++
|
||||
bne t5, t6, dc # if ((q.start_i + 1) == SIZE)
|
||||
mv t5, zero
|
||||
dc:
|
||||
sw t5, 0(t0) # storing start_i
|
||||
slli t2, t4, 5 # index * 32 [log(sizeof(job))]
|
||||
add t1, t1, t2 # jobs + index
|
||||
lw t3, 0 (t1) # wid
|
||||
sw t3, 0 (a1) #
|
||||
lw t3, 4 (t1) # n_threads
|
||||
sw t3, 4 (a1) #
|
||||
lw t3, 8 (t1) # base_sp
|
||||
sw t3, 8 (a1) #
|
||||
lw t3, 12(t1) # func_ptr
|
||||
sw t3, 12(a1) #
|
||||
lw t3, 16(t1) # args
|
||||
sw t3, 16(a1) #
|
||||
lw t3, 20(t1) # assigned_warp
|
||||
sw t3, 20(a1) #
|
||||
ret
|
||||
|
||||
|
||||
.type queue_isFull, @function
|
||||
.global queue_isFull
|
||||
queue_isFull:
|
||||
mv t0, a0 # loading base address of q
|
||||
lw t1, 8 (t0) # t1 = num_j
|
||||
mv a0, zero # ret_val = 0
|
||||
li t3, SIZE # t3 = SIZE
|
||||
bne t3, t1, qf # if (num_j == 1)
|
||||
addi a0, a0, 1 # ret_val = 1;
|
||||
qf:
|
||||
ret
|
||||
|
||||
|
||||
|
||||
.type queue_isEmpty, @function
|
||||
.global queue_isEmpty
|
||||
queue_isEmpty:
|
||||
mv t0, a0 # loading base address of q
|
||||
lw t1, 8 (t0) # t1 = num_j
|
||||
mv a0, zero # ret_val = 0
|
||||
mv t3, zero # t3 = 0
|
||||
bne t3, t1, qe # if (num_j == 0)
|
||||
addi a0, a0, 1 # ret_val = 1;
|
||||
qe:
|
||||
ret
|
||||
|
||||
|
||||
.type queue_availableWarps, @function
|
||||
.global queue_availableWarps
|
||||
queue_availableWarps:
|
||||
mv t0, a0 # loading base address of q
|
||||
lw t1, 12(t0) # t1 = total_warps
|
||||
lw t2, 16(t0) # t2 = active_warps
|
||||
sltu a0, t2, t1
|
||||
ret
|
||||
Reference in New Issue
Block a user