From 3bc7e87a40c8ec066ddd1f92387f6abe12f1d698 Mon Sep 17 00:00:00 2001 From: Kaya Celebi Date: Mon, 10 Apr 2023 05:40:35 -0400 Subject: [PATCH 1/8] parse fixes --- src/riscv_assembler/instr_arr.py | 26 ++++++++++++++++++++++++++ src/riscv_assembler/parse.py | 29 ----------------------------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/riscv_assembler/instr_arr.py b/src/riscv_assembler/instr_arr.py index 04c6d7b..91f4aa2 100644 --- a/src/riscv_assembler/instr_arr.py +++ b/src/riscv_assembler/instr_arr.py @@ -292,6 +292,32 @@ def organize(self, tokens): return BadInstructionError() +def JUMP(x : str, line_num : int) -> int: + raise NotImplementedError() + + # search forward + skip_labels = 0 + for i in range(line_num, len(self.code)): + if x+":" == self.code[i]: + jump_size = (i - line_num - skip_labels) * 4 # how many instructions to jump ahead + return jump_size + + if self.code[i][-1] == ':': + skip_labels += 1 + + # search backward + skip_labels = 0 + for i in range(line_num, -1, -1): + # substruct correct label itself + if self.code[i][-1] == ':': + skip_labels += 1 + + if x+":" == self.code[i]: + jump_size = (i - line_num + skip_labels) * 4 # how many instructions to jump behind + return jump_size + + raise Exception("Address not found!") + def register_map(): path = Path(__file__).parent / "data/reg_map.dat" rmap = {} diff --git a/src/riscv_assembler/parse.py b/src/riscv_assembler/parse.py index fc93f19..9df3209 100644 --- a/src/riscv_assembler/parse.py +++ b/src/riscv_assembler/parse.py @@ -97,33 +97,4 @@ def determine_type(tk : str) -> function: return parsers[i] raise Exception("Bad Instruction Provided!") - ''' - Calculate jump - ''' - def calc_jump(self, x : str, line_num : int) -> int: - raise NotImplementedError() - - # search forward - skip_labels = 0 - for i in range(line_num, len(self.code)): - if x+":" == self.code[i]: - jump_size = (i - line_num - skip_labels) * 4 # how many instructions to jump ahead - return jump_size - - if self.code[i][-1] == ':': - skip_labels += 1 - - # search backward - skip_labels = 0 - for i in range(line_num, -1, -1): - # substruct correct label itself - if self.code[i][-1] == ':': - skip_labels += 1 - - if x+":" == self.code[i]: - jump_size = (i - line_num + skip_labels) * 4 # how many instructions to jump behind - return jump_size - - raise Exception("Address not found!") - Parser = _Parser() \ No newline at end of file From e663bfa4b34f1dd17d04d5bede76414d14291679 Mon Sep 17 00:00:00 2001 From: Kaya Celebi Date: Mon, 10 Apr 2023 05:54:45 -0400 Subject: [PATCH 2/8] package ref error fixed --- src/riscv_assembler/convert.py | 4 ++-- src/riscv_assembler/parse.py | 16 ++++++++++++++-- .../test_class.cpython-36-pytest-6.2.4.pyc | Bin 6612 -> 0 bytes .../test_class.cpython-37-pytest-6.2.1.pyc | Bin 6446 -> 0 bytes .../test_class.cpython-38-pytest-7.1.2.pyc | Bin 3074 -> 0 bytes .../test_class.cpython-38-pytest-7.2.2.pyc | Bin 7033 -> 7033 bytes tests/__pycache__/test_class.cpython-38.pyc | Bin 2532 -> 0 bytes .../test_utils.cpython-36-pytest-6.2.4.pyc | Bin 1652 -> 0 bytes .../test_utils.cpython-37-pytest-6.2.1.pyc | Bin 1039 -> 0 bytes .../test_utils.cpython-38-pytest-7.1.2.pyc | Bin 1558 -> 0 bytes 10 files changed, 16 insertions(+), 4 deletions(-) delete mode 100644 tests/__pycache__/test_class.cpython-36-pytest-6.2.4.pyc delete mode 100644 tests/__pycache__/test_class.cpython-37-pytest-6.2.1.pyc delete mode 100644 tests/__pycache__/test_class.cpython-38-pytest-7.1.2.pyc delete mode 100644 tests/__pycache__/test_class.cpython-38.pyc delete mode 100644 tests/__pycache__/test_utils.cpython-36-pytest-6.2.4.pyc delete mode 100644 tests/__pycache__/test_utils.cpython-37-pytest-6.2.1.pyc delete mode 100644 tests/__pycache__/test_utils.cpython-38-pytest-7.1.2.pyc diff --git a/src/riscv_assembler/convert.py b/src/riscv_assembler/convert.py index b27299d..619f559 100644 --- a/src/riscv_assembler/convert.py +++ b/src/riscv_assembler/convert.py @@ -12,8 +12,8 @@ - Update tests ''' -from src.riscv_assembler.instr_arr import * -from src.riscv_assembler.parse import * +from riscv_assembler.instr_arr import * +from riscv_assembler.parse import * __all__ = ['AssemblyConverter'] diff --git a/src/riscv_assembler/parse.py b/src/riscv_assembler/parse.py index faa5d54..196bbbc 100644 --- a/src/riscv_assembler/parse.py +++ b/src/riscv_assembler/parse.py @@ -1,4 +1,4 @@ -from src.riscv_assembler.instr_arr import * +from riscv_assembler.instr_arr import * from types import FunctionType as function __all__ = ['Parser'] @@ -19,7 +19,7 @@ class _Parser: def __call__(self, *args) -> list: if _Parser.is_file(*args): - return self.read_file(*args) + return _Parser.interpret_file(_Parser.read_file(*args)) return [self.interpret(x) for x in args[0].split("\n")] @staticmethod @@ -56,6 +56,8 @@ def handle_specific_instr(x : list) -> list: if len(x[0]) == 2 and (x[0] in S_instr or x[0] in I_instr): y = x[-1].split('('); y[1] = y[1].replace(')','') return x[0:-1] + y + elif 9==0: + ... return x @@ -72,8 +74,18 @@ def read_file(file : str) -> list: tokens = _Parser.tokenize(line) code += [_Parser.interpret(tokens) for _ in range(1) if len(tokens) != 0] line = file.readline() + file.close() return code + @staticmethod + def interpret_file(code : list) -> list: + int_code = [] + for line in code: + tokens = _Parser.tokenize(line) + int_code += [_Parser.interpret(tokens) for _ in range(1) if len(tokens) != 0] + + return int_code + ''' Tokenize a given line ''' diff --git a/tests/__pycache__/test_class.cpython-36-pytest-6.2.4.pyc b/tests/__pycache__/test_class.cpython-36-pytest-6.2.4.pyc deleted file mode 100644 index d3e9a4aa86ec21c82e3875c6c104a276e65b0c16..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6612 zcmdT|OLN=S6~+ZX5Tr<2@-&SV~6&xE{*EBqITG^7X&PiSuLTD!KF(z4?@;AW8Cb3IpZo)u)a5}pOO zW$I6cHzOUH2G2=XX2A0@D`&t9GAHxk7i2+R0H2k!at?e>UX+)>FUrgE3iu^CFRy}M zme=HU@GJ6$ya_%pUy-kZUzM-PAAnzz3-WdF>+%ixCio5cmb?XiQ@$;4gTErhFOA}z zXVA!~6h&-5szr~%#X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ZV2%`fRev#vk!cvtoJa$UUQqrI;d z`yb%FE8_#*s2L?ipOZRN%DY%$w4t{C>o}s yl0zkwE~fMsaQFSaw(JJ}eSsMv%P|)Puq$%H6|U{3@z1$=&9koSUUaR||9=41w-z)2 diff --git a/tests/__pycache__/test_class.cpython-37-pytest-6.2.1.pyc b/tests/__pycache__/test_class.cpython-37-pytest-6.2.1.pyc deleted file mode 100644 index 12d155cf5a20c467e280486a7b107630cc74c121..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6446 zcmdT|&2!sC6xT|!tT>6Aq-oML1yX2f#YbZ28>WHMLKzrH83-J7KqGsV)UEt6t940= z!!U#c7Z`>U2M*1V|AiArT{$qlbLxrTTRFxyHVq+}Db{G;TfL34Z-4Li-mb0>4`(#| ze);2f&l}XV->7r&)1h3$9sP=iYn+9e%aqj1hORNKY`Q6ySS;6qMGw-m$xC=3q^WFKXTs0eFJy&EE=ipX}g+aQr}~D49=#tUDnVZm@?I1 zdu*RxsIT82@uMgx7s8!68ALKS8#z`y`bP8FjcVmyAY>o}y*;))Z?hBzo)=p+Uj!8y z4;GUVo(N=YL{d0VGZ^`-`DmT)1U#f zmZmGMbA$#2jrEw-V!a?8Q_VZJ{8}xjaCdkskhkixR+k$)wZI*Y+Pgr>s@A11MB)sg z)a}Ro1o=Ue*L0K7f@g4Lb#WR`I{cwkQc?FQl)w8!UbN4i!Yg&uO@&u)y3oSYwU4j?Z9oxe5RLwNPRWieiY{Ut zuXFY7T$3>o>B0Y#ntzcUs6Sk#pL!86B zACtdVZ(&R;?-7f})h%Z5ytNvX^Qb1M)%YGtQf)cgVwA}n?5>Vg(4#LUg(9>~#tnMD zi9qG1G#;4y+FdKU4tq)>FW9bye#Iw?lZprFKO_^(w|5rXI}1rCdBJjfXSKV|Tgsc957?7p z!7Nb2#_F$YLt0i73$XkzLj_SmzosCC;v@+baRFZayI7&!18Oo=Rq-4(7twUbinv6h z1_TWjR7}NXYA9C~Q`42&60q_drruyJ!qOY8 zA7DA)HP^SmtTtwU1@`ISG%*_~yvgiTi`j3&o-lizSlncGiu4Xn|NL;RRm!NS z9qclW=lt-H4v|O7jC623G#WJc#L!r|hqt$?nb}^=uENs0nmxHJ%jCAHnB{VX1()>s z++uG2m4zdLGz0$+4H6ALF_2bw@b(r+9h9N(E6!7~eQ-Wh$AWmuOHP!t$)OIXyjc-^ zCQ1^g!`7oX-F&9zjZfC<5E`fH%XC;Os4ph&q$owjd+KnAkKlorZGO;p&vYB=vJ@t# z-{hpCcE)Narb@f26)Lf)cvkDRK#NAl3$aWMZJz|yV?haCP&N=0go2!GJGQ6;jQXH# pUoBU8Jq%uB7!lEl$JWL)n+-9W*`}SwHDnJfnXzqq%r-i&KLL}=5;Fh* diff --git a/tests/__pycache__/test_class.cpython-38-pytest-7.1.2.pyc b/tests/__pycache__/test_class.cpython-38-pytest-7.1.2.pyc deleted file mode 100644 index b10b54bf76935cf7f49aa5366ba645cad5fe2e45..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3074 zcmds3&2HO95Z+x<6eY`!tt57epoLl>X_z*$q$Y6+)IriephchtsMCXhf}pgNqlEgw zE|tcqe5rd1+7~Etu#S3^K0yIqd&(>L)NhuwE5{DfLr$f@+1Z&DIXm-xvwX0)SY){V z{PD8<%Vq3un#^AUlRLQea|p>Kk64SFQS>drIP2T398Wz?%YjEk`M%q7jm?S*TTI$A z_bY1^r6cng7o;l-7)!D!7cef$l3c{NB$wnFjA!JsT*0_3%knJ76?smc$5@uDat-5I z$-igbg_nqjH9el#_k;K$Mt-$Jro)Q@w{U-fTYmr%vpu%UVjhdw+T)LG$uF`!zRM?U zKR4l1dZ=g~EC*VL{dTmo9)~)vRrSnCR_@||?qOe9uk@FcNE2yn*K5|$s_UVorNrPm(^J3%Lm!gg={z8XFXJF#9@J>7Y7 zEejx2CIW4w--%$Zj&_neYL&y2)dC3$KNV-7rGeDR zI3GwE^Amwko=h1UP`0TER0<@1!XNQ%z5$Em6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Pp=NR^%AK#EvT0O33t z8fq|hnFOW+i66>6xhpr|Avu%{Ns8sTe<(nURZrv~kvk=&Ic9&pzaJ0w<3_hnK}q=z zmQAg79`~lAtX;>Qh@lE)OGo9UgEOx*`zO#^a2m9CVZ=a2>Th|eaIA^KvFlrB(sz2D zRx1p&jUUcP-1>*ulO`_546b1PwxH-63}AUSiu<3vg5u^h6daC82=9(f2cdtgw0}fw z4>1goB2ajeA&cx&1=2G0XP0}aR*ul6E;mcB*$sRfK?9P~)@EG}7o7B$_t zC~6b#9yHYSqxNB(QnKBF2`p;viK6+zR)pKYdrL~mzI5JaKuHOWcjNec3Ng? z`77qz-MIL6m(%|Mrd715N>d|-5|aU*P9qT95qgaUSA}L0G{>y@jZ^E`{TiRX{V;ea Yu_NMgcV%9>wwuM7H_~;Bu9cq7f3<(RhX4Qo diff --git a/tests/__pycache__/test_utils.cpython-36-pytest-6.2.4.pyc b/tests/__pycache__/test_utils.cpython-36-pytest-6.2.4.pyc deleted file mode 100644 index de74647658907c100a78ad485250788a59b06fc1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1652 zcmdT^!IB#_5S3=eQi#KWwLY z(2w!!Q-ENCOE%z6dJ}&V3>wfq8J?2Qm(5u;hgLLjo;WH5us>8?ukgmkS&pj zJ;;5*zhP%heukukLi(%P)psGnRGPrtdD1vTMoyRX6)1*n*@mszgj4eLZ3DLf z>*qpP?{P2nZ1c3LXQt1xR!yu_hwf829RL^)x!Q+34^Dw;r!M&K zQ0m}CJupppqjj)_|5s2Yz}E458|YN-lb^0pm0~JW>@+G|t+~>9 zM@MJrja!S=?Nlc}KT$eI9nyNKzLh4M&QaaHn`(FTsc(Ha32qbIwd|}-HB`n;yO(M* z-%Gh_<47Q0fl#lJ9=jE6a=ci%D(A{x%tpDCnJN})RLvH-Dr^hxY`83?Dd*aTvcd>$ z4>J9zT1w%DX5Y(dn9FRQ&k7r7Iv*Fbf^C215-F?s7fMyiUdqNGWNxzJ@j~YF+`yAI z>>fp^bMEhUKHBZvsXO%oAMbWPd7deu+fA>9J?aYpPz7~}@Sm_2Ycq8nwwH)DwnJoj zaia&I-*>hBKh&X%llqEIM_nX%mEaQKdG@HwFg|0?4H|coOtHItif*}jo#24rD#05B zZxXyka1D?))Z3)LL(n03m*72u^XI9)=ymz}#M2j-?|pdEwvC>W(nYpcvzo?-HIqQC zLsk5!N&`xsn{4xm&E;(`yEo5q&%Jqv?xC~I1zuuV4wa8cHmuimm!;k_@kdb>JE^-( fxQ8nGbXJL_Ebh~5=yni+b`fv!$cy|ai2VNm-7J3n diff --git a/tests/__pycache__/test_utils.cpython-37-pytest-6.2.1.pyc b/tests/__pycache__/test_utils.cpython-37-pytest-6.2.1.pyc deleted file mode 100644 index 880c80c3903e115052e5257e19633677a4a44a0f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1039 zcmYjQOK%e~5VpOKY|^y61S&{Ky&!dwnxutN4g^{%kmw<*cpY+CZFV|dN*2m`PUL+*i! zNlZEEQ)5|XF+xdZ_Z^B6#@)AQEndsKzGr-t*ZcL@j-4N*--z9~26iE)Z;0=mLOs&+ zsiyZq+54e7h|qN*xbZFw>48$P@iC^cUVpg*vJQf_vko5`5Gd2g)4_lzFAI_VCc=SC zqt2eS-^oPC_F*^P~@0Qq3J1|kO@6xQ#N7po1!Ny1~jCxh5jL%*|Dvx z6MIGuUAYZ$N0Av7dw^U-IfFRh31DOCjKlT?>$mhgLDPUXGAnHx*8PN0{?#G7R zVX!G+WV?5C7ip>^Pj!Qkxe8U>ow07$r$_$1)pESy%f{Dpu+m*Y)bZu2-0?OmKoTmgr^9aKEDs#c)4mPkH}RKb}pUAlJe6N{L0Q=~HbWSTe6v}N9= wu9fiP@N^(7T;x`D4clh#xrWW(V7m66WJNsU$x{kBvI)u~*NI1))MK9Y4^EH}A^-pY diff --git a/tests/__pycache__/test_utils.cpython-38-pytest-7.1.2.pyc b/tests/__pycache__/test_utils.cpython-38-pytest-7.1.2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>NW`bX!!TK86Sw`KE6yg0-r1ppH`^Pe8+cv=NIj8 BX_5c{ From c4e9bd4aaa6e884ebbfde6c88be7a45ccf7d9dba Mon Sep 17 00:00:00 2001 From: Kaya Celebi Date: Mon, 10 Apr 2023 06:15:17 -0400 Subject: [PATCH 3/8] pytest issues fixed, seemingly --- .gitignore | 3 +- src/riscv_assembler/parse.py | 27 +++++++++--------- .../test_class.cpython-38-pytest-7.2.2.pyc | Bin 7033 -> 7576 bytes tests/assembly/test4.s | 4 +++ tests/pytest.ini | 2 ++ tests/test_class.py | 16 +++++++++-- 6 files changed, 35 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 0d28edc..435bf35 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ dist riscv_assembler.egg-info build .pytest_cache/ -__pycache__/ +tests/__pycache__/ +src/riscv_assembler/__pycache__/ deprc_setup.py \ No newline at end of file diff --git a/src/riscv_assembler/parse.py b/src/riscv_assembler/parse.py index 196bbbc..13dd736 100644 --- a/src/riscv_assembler/parse.py +++ b/src/riscv_assembler/parse.py @@ -20,7 +20,7 @@ class _Parser: def __call__(self, *args) -> list: if _Parser.is_file(*args): return _Parser.interpret_file(_Parser.read_file(*args)) - return [self.interpret(x) for x in args[0].split("\n")] + return [_Parser.interpret(_Parser.tokenize(x)) for x in args[0].split("\n") if len(_Parser.tokenize(x)) > 0] @staticmethod def is_file(x : str) -> bool: @@ -56,7 +56,7 @@ def handle_specific_instr(x : list) -> list: if len(x[0]) == 2 and (x[0] in S_instr or x[0] in I_instr): y = x[-1].split('('); y[1] = y[1].replace(')','') return x[0:-1] + y - elif 9==0: + elif 'requires jump' == 5: ... return x @@ -66,16 +66,17 @@ def handle_specific_instr(x : list) -> list: ''' @staticmethod def read_file(file : str) -> list: - code = [] - file = open(file, "r") - - line = file.readline() - while line != "": - tokens = _Parser.tokenize(line) - code += [_Parser.interpret(tokens) for _ in range(1) if len(tokens) != 0] - line = file.readline() - file.close() - return code + '''code = [] + file = open(file, "r") + line = file.readline() + while line != "": + tokens = _Parser.tokenize(line) + code += [_Parser.interpret(tokens) for _ in range(1) if len(tokens) != 0] + line = file.readline() + file.close() + return code''' + with open(file) as f: + return f.readlines() @staticmethod def interpret_file(code : list) -> list: @@ -117,6 +118,6 @@ def determine_type(tk : str) -> function: for i in range(len(instr_sets)): if tk in instr_sets[i]: return parsers[i] - raise Exception("Bad Instruction Provided!") + raise Exception("Bad Instruction Provided: " + tk + "!") Parser = _Parser() \ No newline at end of file diff --git a/tests/__pycache__/test_class.cpython-38-pytest-7.2.2.pyc b/tests/__pycache__/test_class.cpython-38-pytest-7.2.2.pyc index 2855344df55de994d8bbf72a3052e62813593bcd..fc66d497ae9bb9e3bd67394a3b08b5a6aaef003d 100644 GIT binary patch delta 1402 zcmaKsO=uHA6vt=Mv`u1m?MIq)w1jCcIsF$KA5kZPq#haeJ1wHg8o;><-ab}yEH7+j8e`j{y{QfiZ-tLd|_Gw{U z5PXPTLwiZ`t1N`E{OW`ccce&q9Zel0{UpPly#$XUHM={2OCI>vv5fi#gpAfoWd zf%XHg7ox4*Hnv>HPC2nFV+8tPVT^-B;i?(#+&dVpx_Po8pyechj`(f)SL9> z=qRU+ahc&#+m^w*{KNap&~P#|s(Ue>vG9Mg80 zkSya6%*j2t12*ItY`_;ed}M_Cj&qsdGRb9{%PbcTqav_Vgp*w&gA8`XV7@El@-+Mg Di2FX0 delta 1087 zcmZvbO=uHA7>0LZ+oVf&H$Uv!ZL%R+5}I1db~lOnQNcq!*jkmQrj#NiZNxy3xVwQ? zMF@Bj49e#py@`k*MUd**gW%1h2Xpr(c=BNJ;LN0LreWvsGJN~a^M3QQFN=S(!m=Rn z93I<0%#H99K|}n9Q#=|*OI#|mdlB99!EZ&_?eGZ?YJm_`(LCJdzrs@?QZVr{D?=ni zB#Y&aP^#HZd^UceQg75YtOEH^#FFBBrZc2)7S2o4Ad3pxq{sz~)L>nFALt_$V$8w` zDSVuT(DD(8>@n^_M^fRN|1;bOOfhY#l!0Zxt+ZQP)HFa$-zR;+oEU=+{|bHvS?c%z zHRDF5CWhJyDX2}MZ>1P~3GFa#Y6HNm8<3h9;PA}#3dvv$pWW-FRbJoJ>8P4? zZs=*<$eULGP$veGa&Ae~#3aqh3VKLS_)RDVAb(<7PYnR`Za`{cfU+n@^N;XKJAj2l zBb=Y}aYNi9r*I-?mFR2ur@Sln8=pSR5ql3zcMGB}Cg{&G39hSNNq@|S4MAO=g0->d z**<^ffWIeJY`bPT@x)|v>vYQQJ>F4^8V=E8@Jx}QhxbL`2z`GmezKJ^wAGKf-o@l* z4c%Zb!#K#au8|r2OGYhPbq(@*%x%~iS3@hm!I9b#kX>K|A z5A1rI73XH7UbQ^9x*D;q^%-!YCx=x!dl6kT=Sk=SkxN7tiCiXfg~(MRB_hj2%0yN` O*OI6JWo;7Ln*1L=Rp+Px diff --git a/tests/assembly/test4.s b/tests/assembly/test4.s index e69de29..b1427f8 100644 --- a/tests/assembly/test4.s +++ b/tests/assembly/test4.s @@ -0,0 +1,4 @@ +add x1 x0 x0 +addi t0 s0 32 +addi t0 s0 32 +sw s0, 0(sp) \ No newline at end of file diff --git a/tests/pytest.ini b/tests/pytest.ini index e69de29..b042f06 100644 --- a/tests/pytest.ini +++ b/tests/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +pythonpath = . src \ No newline at end of file diff --git a/tests/test_class.py b/tests/test_class.py index 786b7ac..8829373 100644 --- a/tests/test_class.py +++ b/tests/test_class.py @@ -1,7 +1,7 @@ import pytest from pathlib import Path -from src.riscv_assembler.convert import AssemblyConverter as AC -from src.riscv_assembler.parse import Parser +from riscv_assembler.convert import AssemblyConverter as AC +from riscv_assembler.parse import Parser #TESTS #test simple.s file, writes to txt and bin @@ -109,6 +109,13 @@ def func13(): return cnv(path) +def func14(): + cnv = AC(hex_mode = True, output_mode='a') + + instr = 'add x1 x0 x0\naddi t0 s0 32\naddi t0 s0 32\nsw s0, 0(sp)' + + return cnv(instr) + #----------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------- @@ -152,4 +159,7 @@ def test_11(): # assert func12() == ['0x00a00413', '0x00a00493', '0x00848263', '0xfe040493'] def test_13(): - assert func13() == ['0x00812023'] \ No newline at end of file + assert func13() == ['0x00812023'] + +def test_14(): + assert func14() == ['0x000000b3', '0x02040293', '0x02040293','0x00812023'] \ No newline at end of file From b5e4df551cf744e4b070430f014ce8298bad4165 Mon Sep 17 00:00:00 2001 From: Kaya Celebi Date: Mon, 10 Apr 2023 06:17:38 -0400 Subject: [PATCH 4/8] Tests pass locally, pycache issue? --- .gitignore | 2 -- .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 165 bytes .../__pycache__/convert.cpython-38.pyc | Bin 0 -> 5986 bytes .../__pycache__/instr_arr.cpython-38.pyc | Bin 0 -> 13312 bytes .../__pycache__/parse.cpython-38.pyc | Bin 0 -> 4133 bytes 5 files changed, 2 deletions(-) create mode 100644 src/riscv_assembler/__pycache__/__init__.cpython-38.pyc create mode 100644 src/riscv_assembler/__pycache__/convert.cpython-38.pyc create mode 100644 src/riscv_assembler/__pycache__/instr_arr.cpython-38.pyc create mode 100644 src/riscv_assembler/__pycache__/parse.cpython-38.pyc diff --git a/.gitignore b/.gitignore index 435bf35..cf3feec 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,4 @@ dist riscv_assembler.egg-info build .pytest_cache/ -tests/__pycache__/ -src/riscv_assembler/__pycache__/ deprc_setup.py \ No newline at end of file diff --git a/src/riscv_assembler/__pycache__/__init__.cpython-38.pyc b/src/riscv_assembler/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a1664f09e4c94657ee87cfba45a3a34da75f954e GIT binary patch literal 165 zcmWIL<>g`k0$l~86cGIwL?8o3AjbiSi&=m~3PUi1CZpd*F$VLsFzWz|SR+%*Zi)~fP!L!)wOX=3WlL4d)L7lN$ChS9 z&)C>nIfu1VfmCHvIpsp7Oez;w-X{N*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^ax9uj#t)FeCpO(PssxRl9|ai| z<#NA7LkIu51*illa<*hgCjbJb0s&*oq6BOmsn{Y?<|R{p*uqJpdNz8G0jb846_v3f zLo4FUR<>m!fis!%BQ-ONnQ=Ts^z~?*+c3UHIu7_9Docuh=4IqGD?S$-7X!L`tofow zy&#NnH<@?lWLS3^o&4_zU+|nT$AKn4}YRA{%4b&zDOe^3b3~zLp(6AGD zby1So%V2HqYUW(Xv%9)3Ua#*lxl6FJay%r+;C5ggE}(_(D5?$@4J(Ulf-DxSVWr z8Gmlj%4Y`OH)*JqzZqCLjFo?lGvqA6C|qp>{lDqHu9XXomS6qn_3PJ7yM%jcVm_Vi zi(-l@(!)X00V#YQ?)&A$I(tTN2W?C$ef-{hV#6KTD?&+Sr)@JaOBWO7Z!-!fLO&4eO2T8$_5wDvMmGd1(-e`~0SKwH6|YiLRs3p`ao_{s<%nB&Uq#0WqNb zQb|6#&Xg{V4Rc3k+9Pr;i;@si{usT4&F*%#pI~?sr7NplidW-=Jxy2v%Bw~zsBzoI z9m@_IB1kgQ3+9FVfaqn^E|UE0S}Z(Df8<9PE@r##m*nxS0G}6-+^BG@6lkuiCRfxt zmv*ehx`xFnQJ0s{YN14@Q5oj2nSz~k*=TXEEvOxC8scA>kbt;?DR}NaA410}6ZOzrkk-CK>c|8PR z2YYoPQ8M&j1{9?Hfw=1%NfukpBG{XU2DgNStIrzdo-jx`&$;Ia$}Jts*C!s^ilNU5F-)ww0~KytvxT zes$&IYI-?+$khHTNO)8x#k0gAd3w}gbqMUg+lN(ZhYcw-zkLFA^X4!0f;5mN4 zWE026hDbjMq>LXG2gHTDGWrWL>L%Uz81dEoc+qnLW(6#rDlu7QY SR_S%}(TKbbvH_p7=KlbE;%Hz1 literal 0 HcmV?d00001 diff --git a/src/riscv_assembler/__pycache__/instr_arr.cpython-38.pyc b/src/riscv_assembler/__pycache__/instr_arr.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..18b4a221b2c6c4654f8165af41191c12886d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HSd0Px!V~?Q+eP=e3ENjB)-RLbV#a@+2;K;jef-9id0`A!DfvK|LtX zd#G`Ubw`XZ)3E*@#mi5YOI63NHY$ER_)D+jFAzcmg@gUrUn9~yAJSJ08WGR%%mr%| zfA)V_d-IhQ6IZ;9eHzo20Uk`&E0_d*KmNc!gyr_RfMIC7#~NEl2cW+{YNf?J`Rr=Knkh z!?-h~OmBzv<2<#Nha4Cl(y!_ZxR!cQThU6|iVpJ*Nvr>#jl0%8?1h(cS#{Br)63@F z7RYwCQ}vV5$qQl+m#^yOlIOn_PXl1}5{?^1OJS5hg8*Ebi%XdsH; zMGd|QyC=V|Vs5#NE5l{4;hQjbFm$p^lJ^aA`KnMx@)q(m=19wBMJ1`s-}22$0~LT^ z#y}f>4Aez!qIA=@KoFHq1=HzN8uAX?G|F?*4I%=^8*|7}zD{xrrRSY$!C6YE*F;G* zsHj&0PRd@XA-~6>=m=~xy8sJKGi{-($U=jDi#f~cC7Z8&>6WasT+HG9VL$H70e*{q z>~eNy=8fQ$4PKZ1xJsM~-r45+@|175w-DwKt|Or9bIuJAAlRHMdmu%}w-9T979ETw z-ze1!7*_**#7Pg5of}J_Rc8r8D9I1lBYnX)79{w*{207^pX5V+f!v@ht}5fQ3|e3_ zWhXP~C#WRl(p;cqskxE|V3n#xX|kw=i^kV|y~4|w>b|tx&uUMTyhOq~5b7Ua^)H%y zi|jlJ4=^QvX4Zquj;=d+A>L_CgUXZR%DVSMbbyoRs$7FBh62q#YGa__&rAp zO?B?HL{&-anikJ~+I0cx)&!JTN?lz~AoS@sR_` yq2#V(`h-4&bqv3t&im2-vif(BySv_>TZ7Hg|7*n}^?*wn@#xq#_Tv{;^8WzxrOS5! literal 0 HcmV?d00001 diff --git a/src/riscv_assembler/__pycache__/parse.cpython-38.pyc b/src/riscv_assembler/__pycache__/parse.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf5d2584b5c4092ffabec818651ab10c0b4d83c8 GIT binary patch literal 4133 zcmai1&2JR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h^{D5|!^J}d!r`5Dn3>y(Eo^lhL}WgfBDxWl+=%yECYX~mw0q9jJbt^FY^w^srd$ConQ zbSMc|;6S*;%R0_#SV6a^tLXu=eo8W2rpZ;6MXUO{x-^*x*ARNgIc6y9Imt=Q%1R#Y&7}To#DNfh-t@ z0kS~Yt>fk=5(++7)z-0~%cB+6v%W3a@@54luGp%r*}9#w({=_BVH@_u5SL5JgeT`; z!!<)bM8`nyxHc5D5{$zY&#&28YPhH2y3^3|cL;vxpuxF2Z5ce6+}#7*AYa5%$s55w zzZjlOE06Q)e+4q>FEFLml{-aiSj!jHwTJm?x^L8uO!A$0+)u>=jFo=st=z$44U4sh zm>!wFzD_({x2gT&Wk>bt_b>GI&jD`LUH6HMvL>y#tEx6BkB{2?2C=}%BV&%wp}R~Y zIwlEl*n!I-zZafLt5MWzZ>uOu>ru3w$Q}IfMCo)CJ>O|}^DmVsl1T?(Bpw2o?#Ah~ zv27c7w(-l6$kd|->8~eA*If+tB&;c-U0KwWpf0anElI1zACPvUPp+5ayOxVPiakT! ztt$MPMoI9wir@=V*?VpVZyL0xQ5D=#Er*rXS$FrJ-18SRL$fPKdTrPZ66g>KR9%8 Date: Mon, 10 Apr 2023 06:21:33 -0400 Subject: [PATCH 5/8] this fix --- src/riscv_assembler/convert.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/riscv_assembler/convert.py b/src/riscv_assembler/convert.py index 619f559..b27299d 100644 --- a/src/riscv_assembler/convert.py +++ b/src/riscv_assembler/convert.py @@ -12,8 +12,8 @@ - Update tests ''' -from riscv_assembler.instr_arr import * -from riscv_assembler.parse import * +from src.riscv_assembler.instr_arr import * +from src.riscv_assembler.parse import * __all__ = ['AssemblyConverter'] From ddf5020a13972a3b9af4c9af5667d5c900baf46a Mon Sep 17 00:00:00 2001 From: Kaya Celebi Date: Mon, 10 Apr 2023 06:22:43 -0400 Subject: [PATCH 6/8] Fix added to incorrect file, adding src. to pytest files not to actual src files --- src/riscv_assembler/convert.py | 4 ++-- tests/test_class.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/riscv_assembler/convert.py b/src/riscv_assembler/convert.py index b27299d..619f559 100644 --- a/src/riscv_assembler/convert.py +++ b/src/riscv_assembler/convert.py @@ -12,8 +12,8 @@ - Update tests ''' -from src.riscv_assembler.instr_arr import * -from src.riscv_assembler.parse import * +from riscv_assembler.instr_arr import * +from riscv_assembler.parse import * __all__ = ['AssemblyConverter'] diff --git a/tests/test_class.py b/tests/test_class.py index 8829373..847f6da 100644 --- a/tests/test_class.py +++ b/tests/test_class.py @@ -1,7 +1,7 @@ import pytest from pathlib import Path -from riscv_assembler.convert import AssemblyConverter as AC -from riscv_assembler.parse import Parser +from src.riscv_assembler.convert import AssemblyConverter as AC +from src.riscv_assembler.parse import Parser #TESTS #test simple.s file, writes to txt and bin From 2130b4af4cabaa2018e402cad6b406d140749ed4 Mon Sep 17 00:00:00 2001 From: Kaya Celebi Date: Mon, 10 Apr 2023 06:29:37 -0400 Subject: [PATCH 7/8] Testing w.o rv --- src/riscv_assembler/convert.py | 4 ++-- src/riscv_assembler/parse.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/riscv_assembler/convert.py b/src/riscv_assembler/convert.py index 619f559..b6a5fc7 100644 --- a/src/riscv_assembler/convert.py +++ b/src/riscv_assembler/convert.py @@ -12,8 +12,8 @@ - Update tests ''' -from riscv_assembler.instr_arr import * -from riscv_assembler.parse import * +from instr_arr import * +from parse import * __all__ = ['AssemblyConverter'] diff --git a/src/riscv_assembler/parse.py b/src/riscv_assembler/parse.py index 13dd736..1de8c98 100644 --- a/src/riscv_assembler/parse.py +++ b/src/riscv_assembler/parse.py @@ -1,4 +1,4 @@ -from riscv_assembler.instr_arr import * +from instr_arr import * from types import FunctionType as function __all__ = ['Parser'] From 6aa711efe8c46bca4e557ce4dad9066ca4226e35 Mon Sep 17 00:00:00 2001 From: Kaya Celebi Date: Mon, 10 Apr 2023 06:34:41 -0400 Subject: [PATCH 8/8] Moving .ini file --- tests/pytest.ini => pytest.ini | 0 .../__pycache__/convert.cpython-38.pyc | Bin 5986 -> 5954 bytes src/riscv_assembler/convert.py | 4 ++-- src/riscv_assembler/parse.py | 2 +- .../test_class.cpython-38-pytest-7.2.2.pyc | Bin 7576 -> 7584 bytes tests/test_class.py | 4 ++-- 6 files changed, 5 insertions(+), 5 deletions(-) rename tests/pytest.ini => pytest.ini (100%) diff --git a/tests/pytest.ini b/pytest.ini similarity index 100% rename from tests/pytest.ini rename to pytest.ini diff --git a/src/riscv_assembler/__pycache__/convert.cpython-38.pyc b/src/riscv_assembler/__pycache__/convert.cpython-38.pyc index 1440fbe83fbf7dbf3edfbf9e2d2d81a88f1d041d..456c6d296760d72967e3d9e088b6223ca3f16cb9 100644 GIT binary patch delta 39 tcmaE)cSw&nl$V!_0SN9tF-|$Mk@vY64`*gxaY<2pVo}j8*2xOuP5}QA4Kx4% delta 70 zcmX@4_ehU7l$V!_0SG?aH%@u7k@vZnj$~10adKIFVsUY5ZccYyZRAUpVU;c}O4gfPBBR7A31V%YF2l$O0Q9B{I{*Lx delta 36 qcmZ2rJ;RzWl$V!_0SFu(8mIi`-N=_J!zezvLPm*Ebn|=}Mn(XvTL~Qi diff --git a/tests/test_class.py b/tests/test_class.py index 847f6da..8829373 100644 --- a/tests/test_class.py +++ b/tests/test_class.py @@ -1,7 +1,7 @@ import pytest from pathlib import Path -from src.riscv_assembler.convert import AssemblyConverter as AC -from src.riscv_assembler.parse import Parser +from riscv_assembler.convert import AssemblyConverter as AC +from riscv_assembler.parse import Parser #TESTS #test simple.s file, writes to txt and bin