From 14c6f67c9df2eaca82a479e10ac44d16ac0f6e88 Mon Sep 17 00:00:00 2001 From: feng-arch Date: Wed, 13 Nov 2024 09:37:18 +0800 Subject: [PATCH] add initial file to this repos --- Makefile | 3 + autograder_test/autograder.o.hold | Bin 0 -> 18264 bytes autograder_test/autograder_makefile | 2 + makefiletest.sh | 92 +++++++ .../dmem_fact_ec.sol | 36 +++ obj files for student testing/os.sol | 248 ++++++++++++++++++ obj files for student testing/test1.sol | 8 + obj files for student testing/test11.sol | 13 + obj files for student testing/test2.sol | 49 ++++ obj files for student testing/test2_.sol | 49 ++++ obj files for student testing/testc.sol | 4 + obj files for student testing/testc1.sol | 12 + obj files for student testing/testc2.sol | 12 + obj files for student testing/testlabel.sol | 3 + obj files for student testing/testone.sol | 2 + obj files for student testing/tests.sol | 18 ++ obj files for student testing/user_draw.sol | 23 ++ .../user_string_ec.sol | 69 +++++ submit/Makefile | 27 ++ submit/lc4.c | 55 ++++ submit/lc4_disassembler.c | 18 ++ submit/lc4_disassembler.h | 25 ++ submit/lc4_loader.c | 27 ++ submit/lc4_loader.h | 32 +++ submit/lc4_memory.c | 94 +++++++ submit/lc4_memory.h | 43 +++ 26 files changed, 964 insertions(+) create mode 100644 Makefile create mode 100644 autograder_test/autograder.o.hold create mode 100644 autograder_test/autograder_makefile create mode 100755 makefiletest.sh create mode 100644 obj files for student testing/dmem_fact_ec.sol create mode 100644 obj files for student testing/os.sol create mode 100644 obj files for student testing/test1.sol create mode 100644 obj files for student testing/test11.sol create mode 100644 obj files for student testing/test2.sol create mode 100644 obj files for student testing/test2_.sol create mode 100644 obj files for student testing/testc.sol create mode 100644 obj files for student testing/testc1.sol create mode 100644 obj files for student testing/testc2.sol create mode 100644 obj files for student testing/testlabel.sol create mode 100644 obj files for student testing/testone.sol create mode 100644 obj files for student testing/tests.sol create mode 100644 obj files for student testing/user_draw.sol create mode 100644 obj files for student testing/user_string_ec.sol create mode 100644 submit/Makefile create mode 100644 submit/lc4.c create mode 100644 submit/lc4_disassembler.c create mode 100644 submit/lc4_disassembler.h create mode 100644 submit/lc4_loader.c create mode 100644 submit/lc4_loader.h create mode 100644 submit/lc4_memory.c create mode 100644 submit/lc4_memory.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b6e416d --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +all: + @echo 'remember to use the "cd submit" command before running make' + \ No newline at end of file diff --git a/autograder_test/autograder.o.hold b/autograder_test/autograder.o.hold new file mode 100644 index 0000000000000000000000000000000000000000..9398e375d0f7be23cae5a09d8afdacc3b803841d GIT binary patch literal 18264 zcmds<4|J5(mB7CUnuy3m#U++jzSdIRt;7ig0*G{|jEqO95sb1uZHHm-_^NXC(huC{oN9;rxtgMuwQ+TB-zRo` z)=bc>3ZzB@?WY?D{O6FSTF(Yj$?^8qv(r2s*8>O~6w2_^Yh`fvAX-oPheaij_KyeB zzM??NpOO2`#X^wsk9@av!NAS_N->ecqKf|P$KwQkVUaUHNRR80Ga+B27={BLH0f$cXu}(a7nT+mTNK0mjD*u6%ARH>p;lE<#9jY9{N>!1R?8VAisyvUC zA6_mc&p<`>^)c9Y?d#+yds6=AvQhT1D6g3z?fTKleNe&Oka;l<$hvxD38MdAYnCa=AO@f5Nk4m(1mE7UeS@Y4=$WW$a>E zc^oSnu9B5bto(v1%~<(UIK-IctymeN%D1o*yhcjy!OA;S!4o&*%$AZ0taM!~D}MqN z)fxA56-EoV+9l4bwEtY7{ZQjKe^LXb)HAOGWR^Pr?c8}Tl;MOP545+A!>I^qL@%g3 z1|i{r9Tz&}I^{ntP1|647tJSTdmSa34Kxfk#^f|1&Q&*iJ6p#Oz>&1}!C7Gi2K?jL zPR0rWdG^j}{|HW?)1J;hMmfw&p1pzM_75-hbP9*iTm_8{VZM@`VH~Z)yp?tCnFp!Q z_6HREP(!&+y`Fkay2r>c(fj5K1E;e=1=8DW5g5!>8BZsk=yHeK8)3_vo2RGGnjW(Fp9X=YGF7k~o*HjjbL z!B;?JrQQgnS`P;(2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$LEq*eyj1TiO>Fw zlqTS<24HZIHWB2LSAmTx3Z>CbY9xJ?d}{TT6^G`@|v zSL2TmU#jt^i2F4Dx5NV)f0=lt#&=WxH){NEh;P#POT=q6evo*h#*Ywh*7)1R+cbWX zc$dcC!vsRvB{$hTPY~a&@tI_&TjOed>CyO?NWWL(i-`AW+(*1$;|nOB!x~>s{Fuhq z5FgYyK1ar4i(ff5$)zAGbWYE+HfmhGA4q7toAgya(Ki06_ZTl|`szJ~>X*`2?=eO+ zef1tg94NAlZPau6&r<)C9rc`ksm9fFdX*2QFD5gv*Qn{Y;Uov;5sj{sHQ`7!?w~#RUMU`o z!)H+xq*EKLfiH#}_6^pg&#CgiwyFy2#Zk(MeYGwaF?$ZgrunRifF?_ksi_xyf%%ZU}NW zWzr4%@-Ik8JA6cQo(W9yoZp;0m%-o{qY+1HS*fwDS56~;@NXf^*ED71*=qC2>YJL7 zruVEaKK?^SuQ{^ZM|(AN9jOGxYKOK(u%)FnPcnX^tPaxi6@1K#b0+FzDUlls*G2S? zGG2Pf?=Xk3ui7g-2O7KiKfGLObdzE9k9w-T^8Y;K2mLRU>e=5e{73Ro@V`6Z1$D8g z?U!j^Kc4>tUngU!kelqUYNxh;4idGWRf3)Os6A)6uj{@fS)-o6v(&y%i(mC$*?kdq q-11j@o75RifIf{COZC-8Z)E{Q~}4mXF@&VcfW@xBnl8ip22% literal 0 HcmV?d00001 diff --git a/autograder_test/autograder_makefile b/autograder_test/autograder_makefile new file mode 100644 index 0000000..f200b5a --- /dev/null +++ b/autograder_test/autograder_makefile @@ -0,0 +1,2 @@ +autograder: + @clang -g autograder.o autograder_helpers.o lc4_memory.o lc4_disassembler.o lc4_loader.o -o autograder \ No newline at end of file diff --git a/makefiletest.sh b/makefiletest.sh new file mode 100755 index 0000000..540c2c6 --- /dev/null +++ b/makefiletest.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +remove_compiled () { + rm -f autograder* + rm -f lc4 + rm -f *.o +} + +ERR='\033[1;31m' +NC='\033[0m' # No Color + +cd submit + +required_files=( "lc4.c" "lc4_disassembler.c" "lc4_disassembler.h" \ + "lc4_loader.c" "lc4_loader.h" "lc4_memory.c" "lc4_memory.h" "Makefile") + +for file in "${required_files[@]}" +do + if [ ! -f $file ]; then + echo -e "${ERR}Required file ${file} does not exist!${NC}" + exit 1 + fi +done + +if [ $1 == "lc4" ]; then + make lc4 + + if [ $? -ne 0 ]; then + echo -e "${ERR}LC4 Makefile failed!${NC}" + remove_compiled + exit + fi + + echo -e "${NC}LC4 Makefile successful!${NC}" + remove_compiled +elif [ $1 == "integration" ]; then + remove_compiled + cp ../autograder_test/* . + make lc4 + + echo -e "${NC}running lc4 on testone.obj and comparing results with correct solution${NC}" + + cp ../obj*/testone.* . + ./lc4 testone.obj + + if [ $? -ne 0 ]; then + echo -e "${ERR}lc4 failed!${NC}" + remove_compiled + exit + fi + + cat testone.sol + + make -f autograder_makefile autograder + + if [ $? -ne 0 ]; then + echo -e "${ERR}Compilation failed!${NC}" + remove_compiled + exit + fi + + ./autograder search_opcode 998 + if [ $? -ne 0 ]; then + echo -e "${NC}Compilation passed, but ${ERR}search opcode unit test failed!${NC}" + remove_compiled + exit + fi + + ./autograder reverse_assemble 999 + if [ $? -ne 0 ]; then + echo -e "${NC}Compilation passed, but ${ERR}reverse assembler unit test failed!${NC}" + remove_compiled + exit + fi + + ./autograder add_to_list 999 + if [ $? -ne 0 ]; then + echo -e "${NC}Compilation passed, but ${ERR}add to list unit test failed!${NC}" + remove_compiled + exit + fi + + + echo -e "${NC}Successfully compiled, sample unit tests passed!${NC}" + echo -e "${NC}This is only a subset of the full tests. Remember to test your lc4 program with the sample .obj files${NC}" + remove_compiled +else + echo -e "${ERR}Invalid or missing argument!${NC}" + echo "Usage:" + echo " ./makefiletest.sh " + exit 1 +fi diff --git a/obj files for student testing/dmem_fact_ec.sol b/obj files for student testing/dmem_fact_ec.sol new file mode 100644 index 0000000..411b639 --- /dev/null +++ b/obj files for student testing/dmem_fact_ec.sol @@ -0,0 +1,36 @@ +