├── assignment-2 ├── benchtest │ ├── en & clear │ │ ├── en & clear.run │ │ ├── en & clear.ans │ │ ├── en & clear.mem │ │ ├── en & clear.in │ │ ├── en & clear.txt │ │ └── en & clear.out │ ├── ad hoc │ │ ├── ad hoc.run │ │ ├── ad hoc.mem │ │ ├── ad hoc.ans │ │ ├── ad hoc.in │ │ ├── ad hoc.txt │ │ └── ad hoc.out │ ├── quick multiply │ │ ├── quick multiply.ans │ │ ├── quick multiply.run │ │ ├── quick multiply.mem │ │ ├── quick multiply.in │ │ ├── quick multiply.txt │ │ └── quick multiply.out │ ├── i-type │ │ ├── i-type.ans │ │ ├── i-type.run │ │ ├── i-type.mem │ │ ├── i-type.in │ │ ├── i-type.txt │ │ └── i-type.out │ ├── bisection │ │ ├── bisection.run │ │ ├── bisection.mem │ │ ├── bisection.in │ │ ├── bisection.data │ │ ├── bisection.ans │ │ ├── bisection.txt │ │ └── bisection.out │ ├── mutual recursion │ │ ├── mutual recursion.out │ │ ├── mutual recursion.run │ │ ├── mutual recursion.ans │ │ ├── mutual recursion.mem │ │ ├── mutual recursion.txt │ │ └── mutual recursion.in │ ├── gcd │ │ ├── gcd.mem │ │ ├── gcd.in │ │ ├── gcd.ans │ │ ├── gcd.txt │ │ ├── gcd.out │ │ └── gcd.run │ ├── bubble sort │ │ ├── bubble sort.mem │ │ ├── bubble sort.in │ │ ├── bubble sort.data │ │ ├── bubble sort.ans │ │ ├── bubble sort.txt │ │ ├── bubble sort.out │ │ └── bubble sort.run │ ├── testjr │ │ ├── testjr.ans │ │ ├── testjr.run │ │ ├── testjr.mem │ │ ├── testjr.in │ │ ├── testjr.txt │ │ └── testjr.out │ ├── factorial │ │ ├── factorial.mem │ │ ├── factorial.run │ │ ├── factorial.ans │ │ ├── factorial.in │ │ ├── factorial.txt │ │ └── factorial.out │ ├── run_simulation.tcl │ ├── assembler.py │ └── cpu_tb.sv ├── makefile ├── check.sh ├── check.py └── index.md ├── assignment-3(I) ├── benchtest │ ├── en & clear │ │ ├── en & clear.run │ │ ├── en & clear.ans │ │ ├── en & clear.mem │ │ ├── en & clear.in │ │ ├── en & clear.txt │ │ └── en & clear.out │ ├── ad hoc │ │ ├── ad hoc.run │ │ ├── ad hoc.mem │ │ ├── ad hoc.ans │ │ ├── ad hoc.in │ │ ├── ad hoc.txt │ │ └── ad hoc.out │ ├── quick multiply │ │ ├── quick multiply.ans │ │ ├── quick multiply.run │ │ ├── quick multiply.mem │ │ ├── quick multiply.in │ │ ├── quick multiply.txt │ │ └── quick multiply.out │ ├── i-type │ │ ├── i-type.ans │ │ ├── i-type.run │ │ ├── i-type.mem │ │ ├── i-type.in │ │ ├── i-type.txt │ │ └── i-type.out │ ├── writeback │ │ ├── writeback.mem │ │ ├── writeback.in │ │ ├── writeback.txt │ │ └── writeback.out │ ├── bisection │ │ ├── bisection.run │ │ ├── bisection.mem │ │ ├── bisection.in │ │ ├── bisection.data │ │ ├── bisection.ans │ │ ├── bisection.txt │ │ └── bisection.out │ ├── mutual recursion │ │ ├── mutual recursion.out │ │ ├── mutual recursion.run │ │ ├── mutual recursion.ans │ │ ├── mutual recursion.mem │ │ ├── mutual recursion.txt │ │ └── mutual recursion.in │ ├── random write │ │ ├── random write.mem │ │ ├── random write.in │ │ ├── random write.txt │ │ ├── random write.out │ │ ├── random write.ans │ │ └── random write.run │ ├── gcd │ │ ├── gcd.mem │ │ ├── gcd.in │ │ ├── gcd.ans │ │ ├── gcd.txt │ │ ├── gcd.out │ │ └── gcd.run │ ├── bubble sort │ │ ├── bubble sort.mem │ │ ├── bubble sort.in │ │ ├── bubble sort.data │ │ ├── bubble sort.ans │ │ ├── bubble sort.txt │ │ ├── bubble sort.out │ │ └── bubble sort.run │ ├── testjr │ │ ├── testjr.ans │ │ ├── testjr.run │ │ ├── testjr.mem │ │ ├── testjr.in │ │ ├── testjr.txt │ │ └── testjr.out │ ├── factorial │ │ ├── factorial.mem │ │ ├── factorial.run │ │ ├── factorial.ans │ │ ├── factorial.in │ │ ├── factorial.txt │ │ └── factorial.out │ ├── run_simulation.tcl │ ├── README.md │ ├── assembler.py │ └── cpu_tb.sv ├── img │ └── cache.png ├── makefile ├── src │ ├── cache.vh │ ├── line.v │ ├── cache_controller.v │ ├── set.v │ └── cache.v └── index.md ├── logo.png ├── assignment-1 ├── benchtest │ ├── ad hoc │ │ ├── ad hoc.run │ │ ├── ad hoc.mem │ │ ├── ad hoc.ans │ │ ├── ad hoc.in │ │ ├── ad hoc.txt │ │ └── ad hoc.out │ ├── quick multiply │ │ ├── quick multiply.ans │ │ ├── quick multiply.run │ │ ├── quick multiply.mem │ │ ├── quick multiply.in │ │ ├── quick multiply.txt │ │ └── quick multiply.out │ ├── testzeroext │ │ ├── testzeroext.run │ │ ├── testzeroext.mem │ │ ├── testzeroext.ans │ │ ├── testzeroext.in │ │ ├── testzeroext.txt │ │ └── testzeroext.out │ ├── bisection │ │ ├── bisection.run │ │ ├── bisection.mem │ │ ├── bisection.in │ │ ├── bisection.data │ │ ├── bisection.ans │ │ ├── bisection.txt │ │ └── bisection.out │ ├── gcd │ │ ├── gcd.mem │ │ ├── gcd.in │ │ ├── gcd.txt │ │ ├── gcd.ans │ │ ├── gcd.out │ │ └── gcd.run │ ├── bubble sort │ │ ├── bubble sort.mem │ │ ├── bubble sort.in │ │ ├── bubble sort.data │ │ ├── bubble sort.ans │ │ ├── bubble sort.txt │ │ ├── bubble sort.out │ │ └── bubble sort.run │ ├── factorial │ │ ├── factorial.mem │ │ ├── factorial.run │ │ ├── factorial.ans │ │ ├── factorial.in │ │ ├── factorial.txt │ │ └── factorial.out │ ├── run_simulation.tcl │ ├── cpu_tb.sv │ └── assembler.py ├── makefile └── index.md ├── logo-rev.png ├── assignment-3(II) ├── img │ └── tech.png ├── src │ ├── bpb.vh │ └── bpb.v └── index.md ├── .gitignore ├── README.md └── index.html /assignment-2/benchtest/en & clear/en & clear.run: -------------------------------------------------------------------------------- 1 | [0x00000004]=0x0000000b -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/en & clear/en & clear.run: -------------------------------------------------------------------------------- 1 | [0x00000004]=0x0000000b -------------------------------------------------------------------------------- /assignment-2/benchtest/en & clear/en & clear.ans: -------------------------------------------------------------------------------- 1 | 00000030 2 | 00000000 3 | 0000000b -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/en & clear/en & clear.ans: -------------------------------------------------------------------------------- 1 | 00000030 2 | 00000000 3 | 0000000b -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunflowerAries/ICS-Spring20-Fudan/HEAD/logo.png -------------------------------------------------------------------------------- /assignment-1/benchtest/ad hoc/ad hoc.run: -------------------------------------------------------------------------------- 1 | [0x00000050]=0x00000007 2 | [0x00000054]=0x00000007 -------------------------------------------------------------------------------- /assignment-2/benchtest/ad hoc/ad hoc.run: -------------------------------------------------------------------------------- 1 | [0x00000050]=0x00000007 2 | [0x00000054]=0x00000007 -------------------------------------------------------------------------------- /logo-rev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunflowerAries/ICS-Spring20-Fudan/HEAD/logo-rev.png -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/ad hoc/ad hoc.run: -------------------------------------------------------------------------------- 1 | [0x00000050]=0x00000007 2 | [0x00000054]=0x00000007 -------------------------------------------------------------------------------- /assignment-1/benchtest/quick multiply/quick multiply.ans: -------------------------------------------------------------------------------- 1 | 00000034 2 | 00000063 3 | 000001ef 4 | 00000e4f -------------------------------------------------------------------------------- /assignment-1/benchtest/testzeroext/testzeroext.run: -------------------------------------------------------------------------------- 1 | [0x00000020]=0x0000ffff 2 | [0x00000028]=0x0000ffff -------------------------------------------------------------------------------- /assignment-2/benchtest/quick multiply/quick multiply.ans: -------------------------------------------------------------------------------- 1 | 00000040 2 | 00000063 3 | 000001ef 4 | 00000e4f -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/quick multiply/quick multiply.ans: -------------------------------------------------------------------------------- 1 | 00000040 2 | 00000063 3 | 000001ef 4 | 00000e4f -------------------------------------------------------------------------------- /assignment-2/benchtest/i-type/i-type.ans: -------------------------------------------------------------------------------- 1 | 00000044 2 | 00000000 3 | 00000001 4 | 0000f81c 5 | 0000781c 6 | 0000fff9 7 | fffffffc -------------------------------------------------------------------------------- /assignment-3(I)/img/cache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunflowerAries/ICS-Spring20-Fudan/HEAD/assignment-3(I)/img/cache.png -------------------------------------------------------------------------------- /assignment-3(II)/img/tech.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunflowerAries/ICS-Spring20-Fudan/HEAD/assignment-3(II)/img/tech.png -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/i-type/i-type.ans: -------------------------------------------------------------------------------- 1 | 00000044 2 | 00000000 3 | 00000001 4 | 0000f81c 5 | 0000781c 6 | 0000fff9 7 | fffffffc -------------------------------------------------------------------------------- /assignment-1/benchtest/quick multiply/quick multiply.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x00000063 2 | [0x00000004]=0x000001ef 3 | [0x00000008]=0x00000e4f -------------------------------------------------------------------------------- /assignment-2/benchtest/quick multiply/quick multiply.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x00000063 2 | [0x00000004]=0x000001ef 3 | [0x00000008]=0x00000e4f -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/quick multiply/quick multiply.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x00000063 2 | [0x00000004]=0x000001ef 3 | [0x00000008]=0x00000e4f -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/writeback/writeback.mem: -------------------------------------------------------------------------------- 1 | 00002020 2 | 20060200 3 | 8c850000 4 | 20840008 5 | 14c4fffd 6 | 00000000 7 | 00000000 8 | 00000000 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | index.html.bk 2 | assignment-3(I)/cache-test/ 3 | assignment-3(I)/README* 4 | Assignment-3.md 5 | #assignment-1/benchtest/assembler.py 6 | -------------------------------------------------------------------------------- /assignment-1/benchtest/bisection/bisection.run: -------------------------------------------------------------------------------- 1 | [0x00000080]=0x0000000f 2 | [0x00000084]=0x00000017 3 | [0x00000088]=0x00000013 4 | [0x0000008c]=0x00000011 -------------------------------------------------------------------------------- /assignment-2/benchtest/bisection/bisection.run: -------------------------------------------------------------------------------- 1 | [0x00000080]=0x0000000f 2 | [0x00000084]=0x00000017 3 | [0x00000088]=0x00000013 4 | [0x0000008c]=0x00000011 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bisection/bisection.run: -------------------------------------------------------------------------------- 1 | [0x00000080]=0x0000000f 2 | [0x00000084]=0x00000017 3 | [0x00000088]=0x00000013 4 | [0x0000008c]=0x00000011 -------------------------------------------------------------------------------- /assignment-2/benchtest/mutual recursion/mutual recursion.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunflowerAries/ICS-Spring20-Fudan/HEAD/assignment-2/benchtest/mutual recursion/mutual recursion.out -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/mutual recursion/mutual recursion.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SunflowerAries/ICS-Spring20-Fudan/HEAD/assignment-3(I)/benchtest/mutual recursion/mutual recursion.out -------------------------------------------------------------------------------- /assignment-2/benchtest/i-type/i-type.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x00000000 2 | [0x00000004]=0x00000001 3 | [0x00000008]=0x0000f81c 4 | [0x0000000c]=0x0000781c 5 | [0x00000010]=0x0000fff9 6 | [0x00000014]=0xfffffffc -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/writeback/writeback.in: -------------------------------------------------------------------------------- 1 | add $a0, $0, $0 2 | addi $a2, $0, 512 3 | start: 4 | lw $a1, 0($a0) 5 | addi $a0, $a0, 8 6 | bne $a0, $a2, start 7 | nop 8 | nop 9 | nop 10 | -------------------------------------------------------------------------------- /assignment-1/benchtest/testzeroext/testzeroext.mem: -------------------------------------------------------------------------------- 1 | 2004ffff 2 | 20050000 3 | 201d0020 4 | 3084ffff 5 | 34a5ffff 6 | afa40000 7 | afa50008 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/i-type/i-type.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x00000000 2 | [0x00000004]=0x00000001 3 | [0x00000008]=0x0000f81c 4 | [0x0000000c]=0x0000781c 5 | [0x00000010]=0x0000fff9 6 | [0x00000014]=0xfffffffc -------------------------------------------------------------------------------- /assignment-3(II)/src/bpb.vh: -------------------------------------------------------------------------------- 1 | `ifndef BPB_VH 2 | `define BPB_VH 3 | 4 | `timescale 1ns / 1ps 5 | 6 | // number of entries 7 | `define BPB_E 8 8 | // index bits 9 | `define BPB_T 10 10 | 11 | `endif -------------------------------------------------------------------------------- /assignment-2/benchtest/en & clear/en & clear.mem: -------------------------------------------------------------------------------- 1 | 20020005 2 | 2003000c 3 | 2067fff7 4 | 00e22025 5 | 00642824 6 | 00a42820 7 | 14050001 8 | 00a42820 9 | ac050004 10 | 00000000 11 | 00000000 12 | 00000000 13 | -------------------------------------------------------------------------------- /assignment-1/benchtest/testzeroext/testzeroext.ans: -------------------------------------------------------------------------------- 1 | 0000001c 2 | 00000000 3 | 00000000 4 | 00000000 5 | 00000000 6 | 00000000 7 | 00000000 8 | 00000000 9 | 00000000 10 | 0000ffff 11 | 00000000 12 | 0000ffff 13 | -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/en & clear/en & clear.mem: -------------------------------------------------------------------------------- 1 | 20020005 2 | 2003000c 3 | 2067fff7 4 | 00e22025 5 | 00642824 6 | 00a42820 7 | 14050001 8 | 00a42820 9 | ac050004 10 | 00000000 11 | 00000000 12 | 00000000 13 | -------------------------------------------------------------------------------- /assignment-1/benchtest/gcd/gcd.mem: -------------------------------------------------------------------------------- 1 | 200200bd 2 | 2003011f 3 | 00002020 4 | ac820000 5 | ac830004 6 | 20840008 7 | 10620007 8 | 0043082a 9 | 10010003 10 | 00400820 11 | 00601020 12 | 00201820 13 | 00431022 14 | 08000003 15 | 00000000 -------------------------------------------------------------------------------- /assignment-1/benchtest/testzeroext/testzeroext.in: -------------------------------------------------------------------------------- 1 | addi $a0, $0, -1 2 | addi $a1, $0, 0 3 | addi $sp, $0, 32 4 | andi $a0, $a0, -1 5 | ori $a1, $a1, -1 6 | sw $a0, 0($sp) 7 | sw $a1, 8($sp) 8 | nop 9 | nop 10 | nop 11 | nop 12 | nop -------------------------------------------------------------------------------- /assignment-1/benchtest/quick multiply/quick multiply.mem: -------------------------------------------------------------------------------- 1 | 20080063 2 | 20090025 3 | 20100000 4 | 20040000 5 | 10090008 6 | 312a0001 7 | 100a0003 8 | 02088020 9 | ac900000 10 | 20840004 11 | 00084040 12 | 00094842 13 | 08000004 14 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/writeback/writeback.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h00002020; 2 | RAM[1] <= 32'h20060200; 3 | RAM[2] <= 32'h8c850000; 4 | RAM[3] <= 32'h20840008; 5 | RAM[4] <= 32'h14c4fffd; 6 | RAM[5] <= 32'h00000000; 7 | RAM[6] <= 32'h00000000; 8 | RAM[7] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-2/benchtest/gcd/gcd.mem: -------------------------------------------------------------------------------- 1 | 200200bd 2 | 2003011f 3 | 00002020 4 | ac820000 5 | ac830004 6 | 20840008 7 | 10620007 8 | 0043082a 9 | 10010003 10 | 00400820 11 | 00601020 12 | 00201820 13 | 00431022 14 | 08000003 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/random write/random write.mem: -------------------------------------------------------------------------------- 1 | 20080011 2 | 20090020 3 | 200b0010 4 | 20100000 5 | 200a0000 6 | 02088020 7 | 320c007f 8 | 000c6080 9 | ad880000 10 | 214a0001 11 | 156afffa 12 | 21080001 13 | 1528fff7 14 | 00000000 15 | 00000000 16 | 00000000 17 | -------------------------------------------------------------------------------- /assignment-2/benchtest/i-type/i-type.mem: -------------------------------------------------------------------------------- 1 | 20180771 2 | 2019f81c 3 | 2b11f81c 4 | ac110000 5 | 2b3107e4 6 | ac110004 7 | 3331ffff 8 | ac110008 9 | 33317fff 10 | ac11000c 11 | 3711fff8 12 | ac110010 13 | 373107e4 14 | ac110014 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/gcd/gcd.mem: -------------------------------------------------------------------------------- 1 | 200200bd 2 | 2003011f 3 | 00002020 4 | ac820000 5 | ac830004 6 | 20840008 7 | 10620007 8 | 0043082a 9 | 10010003 10 | 00400820 11 | 00601020 12 | 00201820 13 | 00431022 14 | 08000003 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 -------------------------------------------------------------------------------- /assignment-1/benchtest/bisection/bisection.mem: -------------------------------------------------------------------------------- 1 | 2002002c 2 | 20040000 3 | 2005001f 4 | 20100080 5 | 00853020 6 | 00063043 7 | ae060000 8 | 22100004 9 | 00063880 10 | 8ce30000 11 | 0062882a 12 | 14110003 13 | 10620004 14 | 00c02820 15 | 08000004 16 | 00c02020 17 | 08000004 18 | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/quick multiply/quick multiply.mem: -------------------------------------------------------------------------------- 1 | 20080063 2 | 20090025 3 | 20100000 4 | 20040000 5 | 10090008 6 | 312a0001 7 | 100a0003 8 | 02088020 9 | ac900000 10 | 20840004 11 | 00084040 12 | 00094842 13 | 08000004 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/i-type/i-type.mem: -------------------------------------------------------------------------------- 1 | 20180771 2 | 2019f81c 3 | 2b11f81c 4 | ac110000 5 | 2b3107e4 6 | ac110004 7 | 3331ffff 8 | ac110008 9 | 33317fff 10 | ac11000c 11 | 3711fff8 12 | ac110010 13 | 373107e4 14 | ac110014 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/quick multiply/quick multiply.mem: -------------------------------------------------------------------------------- 1 | 20080063 2 | 20090025 3 | 20100000 4 | 20040000 5 | 10090008 6 | 312a0001 7 | 100a0003 8 | 02088020 9 | ac900000 10 | 20840004 11 | 00084040 12 | 00094842 13 | 08000004 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 -------------------------------------------------------------------------------- /assignment-1/benchtest/bubble sort/bubble sort.mem: -------------------------------------------------------------------------------- 1 | 00004020 2 | 200b0080 3 | 0008e820 4 | 8fac0000 5 | 001d6820 6 | 8fae0000 7 | 01cc782a 8 | 140f0002 9 | 000e6020 10 | 03a06820 11 | 23bd0004 12 | 157dfff9 13 | 216bfffc 14 | 8d780000 15 | ad6c0000 16 | adb80000 17 | 1560fff1 18 | 00000000 -------------------------------------------------------------------------------- /assignment-1/makefile: -------------------------------------------------------------------------------- 1 | export VIVADO_PATH=/home/sunflower/Xilinx/Vivado/2019.2/bin/vivado 2 | PROJECT_DIR:=. 3 | SIM:=sim_1 4 | PROJECT_NAME:=project_1 5 | 6 | test: 7 | SIMULATION=${SIM} ${VIVADO_PATH} -mode tcl -source benchtest/run_simulation.tcl ${PROJECT_DIR}/${PROJECT_NAME}.xpr 8 | 9 | -------------------------------------------------------------------------------- /assignment-2/makefile: -------------------------------------------------------------------------------- 1 | export VIVADO_PATH=/home/sunflower/Xilinx/Vivado/2019.2/bin/vivado 2 | PROJECT_DIR:=. 3 | SIM:=sim_1 4 | PROJECT_NAME:=Pipeline 5 | 6 | test: 7 | SIMULATION=${SIM} ${VIVADO_PATH} -mode tcl -source benchtest/run_simulation.tcl ${PROJECT_DIR}/${PROJECT_NAME}.xpr 8 | 9 | -------------------------------------------------------------------------------- /assignment-1/benchtest/ad hoc/ad hoc.mem: -------------------------------------------------------------------------------- 1 | 20020005 2 | 2003000c 3 | 2067fff7 4 | 00e22025 5 | 00642824 6 | 00a42820 7 | 10a7000a 8 | 0064202a 9 | 10800001 10 | 20050000 11 | 00e2202a 12 | 00853820 13 | 00e23822 14 | ac670044 15 | 8c020050 16 | 08000011 17 | 20020001 18 | ac020054 19 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/makefile: -------------------------------------------------------------------------------- 1 | export VIVADO_PATH=/home/sunflower/Xilinx/Vivado/2019.2/bin/vivado 2 | PROJECT_DIR:=. 3 | SIM:=sim_1 4 | PROJECT_NAME:=mips-cache 5 | 6 | test: 7 | SIMULATION=${SIM} ${VIVADO_PATH} -mode tcl -source benchtest/run_simulation.tcl ${PROJECT_DIR}/${PROJECT_NAME}.xpr 8 | 9 | -------------------------------------------------------------------------------- /assignment-2/benchtest/en & clear/en & clear.in: -------------------------------------------------------------------------------- 1 | addi $v0, $0, 5 2 | addi $v1, $0, 12 3 | addi $a3, $v1, -9 4 | or $a0, $a3, $v0 5 | and $a1, $v1, $a0 6 | add $a1, $a1, $a0 7 | bne $a1, $0, around # should be taken 8 | add $a1, $a1, $a0 9 | around: 10 | sw $a1, 4($0) 11 | nop 12 | nop 13 | nop 14 | nop -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/en & clear/en & clear.in: -------------------------------------------------------------------------------- 1 | addi $v0, $0, 5 2 | addi $v1, $0, 12 3 | addi $a3, $v1, -9 4 | or $a0, $a3, $v0 5 | and $a1, $v1, $a0 6 | add $a1, $a1, $a0 7 | bne $a1, $0, around # should be taken 8 | add $a1, $a1, $a0 9 | around: 10 | sw $a1, 4($0) 11 | nop 12 | nop 13 | nop 14 | nop -------------------------------------------------------------------------------- /assignment-2/benchtest/bisection/bisection.mem: -------------------------------------------------------------------------------- 1 | 2002002c 2 | 20040000 3 | 2005001f 4 | 20100080 5 | 00853020 6 | 00063043 7 | ae060000 8 | 22100004 9 | 00063880 10 | 8ce30000 11 | 0062882a 12 | 14110003 13 | 10620004 14 | 00c02820 15 | 08000004 16 | 00c02020 17 | 08000004 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bisection/bisection.mem: -------------------------------------------------------------------------------- 1 | 2002002c 2 | 20040000 3 | 2005001f 4 | 20100080 5 | 00853020 6 | 00063043 7 | ae060000 8 | 22100004 9 | 00063880 10 | 8ce30000 11 | 0062882a 12 | 14110003 13 | 10620004 14 | 00c02820 15 | 08000004 16 | 00c02020 17 | 08000004 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/ad hoc/ad hoc.mem: -------------------------------------------------------------------------------- 1 | 20020005 2 | 2003000c 3 | 2067fff7 4 | 00e22025 5 | 00642824 6 | 00a42820 7 | 10a7000a 8 | 0064202a 9 | 10800001 10 | 20050000 11 | 00e2202a 12 | 00853820 13 | 00e23822 14 | ac670044 15 | 8c020050 16 | 08000011 17 | 20020001 18 | ac020054 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/bubble sort/bubble sort.mem: -------------------------------------------------------------------------------- 1 | 00004020 2 | 200b0080 3 | 0008e820 4 | 8fac0000 5 | 001d6820 6 | 8fae0000 7 | 01cc782a 8 | 140f0002 9 | 000e6020 10 | 03a06820 11 | 23bd0004 12 | 157dfff9 13 | 216bfffc 14 | 8d780000 15 | ad6c0000 16 | adb80000 17 | 1560fff1 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bubble sort/bubble sort.mem: -------------------------------------------------------------------------------- 1 | 00004020 2 | 200b0080 3 | 0008e820 4 | 8fac0000 5 | 001d6820 6 | 8fae0000 7 | 01cc782a 8 | 140f0002 9 | 000e6020 10 | 03a06820 11 | 23bd0004 12 | 157dfff9 13 | 216bfffc 14 | 8d780000 15 | ad6c0000 16 | adb80000 17 | 1560fff1 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/ad hoc/ad hoc.mem: -------------------------------------------------------------------------------- 1 | 20020005 2 | 2003000c 3 | 2067fff7 4 | 00e22025 5 | 00642824 6 | 00a42820 7 | 10a7000a 8 | 0064202a 9 | 10800001 10 | 20050000 11 | 00e2202a 12 | 00853820 13 | 00e23822 14 | ac670044 15 | 8c020050 16 | 08000011 17 | 20020001 18 | ac020054 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000000 -------------------------------------------------------------------------------- /assignment-1/benchtest/gcd/gcd.in: -------------------------------------------------------------------------------- 1 | addi $v0,$0,189 2 | addi $v1,$0,287 3 | add $a0, $0, $0 4 | main: 5 | sw $v0, 0($a0) 6 | sw $v1, 4($a0) 7 | addi $a0, $a0, 8 8 | beq $v0,$v1,end 9 | slt $at,$v0,$v1 10 | beq $at,$0,run 11 | add $at,$v0,$0 12 | add $v0,$v1,$0 13 | add $v1,$at,$0 14 | run: 15 | sub $v0,$v0,$v1 16 | j main 17 | end: 18 | nop -------------------------------------------------------------------------------- /assignment-1/benchtest/ad hoc/ad hoc.ans: -------------------------------------------------------------------------------- 1 | 00000048 2 | 00000000 3 | 00000000 4 | 00000000 5 | 00000000 6 | 00000000 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000000 13 | 00000000 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000007 23 | 00000007 -------------------------------------------------------------------------------- /assignment-2/benchtest/ad hoc/ad hoc.ans: -------------------------------------------------------------------------------- 1 | 00000054 2 | 00000000 3 | 00000000 4 | 00000000 5 | 00000000 6 | 00000000 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000000 13 | 00000000 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000007 23 | 00000007 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/ad hoc/ad hoc.ans: -------------------------------------------------------------------------------- 1 | 00000054 2 | 00000000 3 | 00000000 4 | 00000000 5 | 00000000 6 | 00000000 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000000 13 | 00000000 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000007 23 | 00000007 -------------------------------------------------------------------------------- /assignment-1/benchtest/quick multiply/quick multiply.in: -------------------------------------------------------------------------------- 1 | addi $t0, $0, 99 2 | addi $t1, $0, 37 3 | addi $s0, $0, 0 4 | addi $a0, $0, 0 5 | while: 6 | beq $t1, $0, done 7 | andi $t2, $t1, 1 8 | beq $t2, $0, target 9 | add $s0, $s0, $t0 10 | sw $s0, 0($a0) 11 | addi $a0, $a0, 4 12 | target: 13 | sll $t0, $t0, 1 14 | srl $t1, $t1, 1 15 | j while 16 | done: 17 | nop -------------------------------------------------------------------------------- /assignment-1/benchtest/testzeroext/testzeroext.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h2004ffff; 2 | RAM[1] <= 32'h20050000; 3 | RAM[2] <= 32'h201d0020; 4 | RAM[3] <= 32'h3084ffff; 5 | RAM[4] <= 32'h34a5ffff; 6 | RAM[5] <= 32'hafa40000; 7 | RAM[6] <= 32'hafa50008; 8 | RAM[7] <= 32'h00000000; 9 | RAM[8] <= 32'h00000000; 10 | RAM[9] <= 32'h00000000; 11 | RAM[10] <= 32'h00000000; 12 | -------------------------------------------------------------------------------- /assignment-2/benchtest/testjr/testjr.ans: -------------------------------------------------------------------------------- 1 | 000000fc 2 | 000000dc 3 | 000000f0 4 | 0000006c 5 | 000000ec 6 | 00000090 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000064 13 | 00000000 14 | 00000064 15 | 00000000 16 | 00000064 17 | 00000000 18 | 00000064 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000000 23 | 00000000 24 | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/gcd/gcd.in: -------------------------------------------------------------------------------- 1 | addi $v0,$0,189 2 | addi $v1,$0,287 3 | add $a0, $0, $0 4 | main: 5 | sw $v0, 0($a0) 6 | sw $v1, 4($a0) 7 | addi $a0, $a0, 8 8 | beq $v0,$v1,end 9 | slt $at,$v0,$v1 10 | beq $at,$0,run 11 | add $at,$v0,$0 12 | add $v0,$v1,$0 13 | add $v1,$at,$0 14 | run: 15 | sub $v0,$v0,$v1 16 | j main 17 | end: 18 | nop 19 | nop 20 | nop 21 | nop -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/testjr/testjr.ans: -------------------------------------------------------------------------------- 1 | 000000fc 2 | 000000dc 3 | 000000f0 4 | 0000006c 5 | 000000ec 6 | 00000090 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000064 13 | 00000000 14 | 00000064 15 | 00000000 16 | 00000064 17 | 00000000 18 | 00000064 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000000 23 | 00000000 24 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/gcd/gcd.in: -------------------------------------------------------------------------------- 1 | addi $v0,$0,189 2 | addi $v1,$0,287 3 | add $a0, $0, $0 4 | main: 5 | sw $v0, 0($a0) 6 | sw $v1, 4($a0) 7 | addi $a0, $a0, 8 8 | beq $v0,$v1,end 9 | slt $at,$v0,$v1 10 | beq $at,$0,run 11 | add $at,$v0,$0 12 | add $v0,$v1,$0 13 | add $v1,$at,$0 14 | run: 15 | sub $v0,$v0,$v1 16 | j main 17 | end: 18 | nop 19 | nop 20 | nop 21 | nop -------------------------------------------------------------------------------- /assignment-2/benchtest/i-type/i-type.in: -------------------------------------------------------------------------------- 1 | addi $t8, $0, 1905 2 | addi $t9, $0, -2020 3 | slti $s1, $t8, -2020 4 | sw $s1, 0($0) 5 | slti $s1, $t9, 2020 6 | sw $s1, 4($0) 7 | andi $s1, $t9, -1 8 | sw $s1, 8($0) 9 | andi $s1, $t9, 32767 10 | sw $s1, 12($0) 11 | ori $s1, $t8, -8 12 | sw $s1, 16($0) 13 | ori $s1, $t9, 2020 14 | sw $s1, 20($0) 15 | nop 16 | nop 17 | nop 18 | nop 19 | -------------------------------------------------------------------------------- /assignment-1/benchtest/factorial/factorial.mem: -------------------------------------------------------------------------------- 1 | 201d0080 2 | 20040005 3 | 20050000 4 | 0c000007 5 | aca20000 6 | 00021040 7 | 00000000 8 | 23bdfff8 9 | afa40004 10 | afbf0000 11 | 20080002 12 | 0088402a 13 | 10080003 14 | 20020001 15 | 23bd0008 16 | 03e00008 17 | 2084ffff 18 | 0c000007 19 | 8fbf0000 20 | 8fa40004 21 | 23bd0008 22 | aca20000 23 | 00821020 24 | 20a50004 25 | 03e00008 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/i-type/i-type.in: -------------------------------------------------------------------------------- 1 | addi $t8, $0, 1905 2 | addi $t9, $0, -2020 3 | slti $s1, $t8, -2020 4 | sw $s1, 0($0) 5 | slti $s1, $t9, 2020 6 | sw $s1, 4($0) 7 | andi $s1, $t9, -1 8 | sw $s1, 8($0) 9 | andi $s1, $t9, 32767 10 | sw $s1, 12($0) 11 | ori $s1, $t8, -8 12 | sw $s1, 16($0) 13 | ori $s1, $t9, 2020 14 | sw $s1, 20($0) 15 | nop 16 | nop 17 | nop 18 | nop 19 | -------------------------------------------------------------------------------- /assignment-2/benchtest/quick multiply/quick multiply.in: -------------------------------------------------------------------------------- 1 | addi $t0, $0, 99 2 | addi $t1, $0, 37 3 | addi $s0, $0, 0 4 | addi $a0, $0, 0 5 | while: 6 | beq $t1, $0, done 7 | andi $t2, $t1, 1 8 | beq $t2, $0, target 9 | add $s0, $s0, $t0 10 | sw $s0, 0($a0) 11 | addi $a0, $a0, 4 12 | target: 13 | sll $t0, $t0, 1 14 | srl $t1, $t1, 1 15 | j while 16 | done: 17 | nop 18 | nop 19 | nop 20 | nop -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/random write/random write.in: -------------------------------------------------------------------------------- 1 | addi $t0, $0, 17 2 | addi $t1, $0, 32 3 | addi $t3, $0, 16 4 | addi $s0, $0, 0 5 | For: 6 | addi $t2, $0, 0 7 | for: 8 | add $s0, $s0, $t0 9 | andi $t4, $s0, 127 10 | sll $t4, $t4, 2 11 | sw $t0, 0($t4) 12 | addi $t2, $t2, 1 13 | bne $t2, $t3, for 14 | addi $t0, $t0, 1 15 | bne $t0, $t1, For 16 | nop 17 | nop 18 | nop 19 | nop 20 | -------------------------------------------------------------------------------- /assignment-2/benchtest/en & clear/en & clear.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20020005; 2 | RAM[1] <= 32'h2003000c; 3 | RAM[2] <= 32'h2067fff7; 4 | RAM[3] <= 32'h00e22025; 5 | RAM[4] <= 32'h00642824; 6 | RAM[5] <= 32'h00a42820; 7 | RAM[6] <= 32'h14050001; 8 | RAM[7] <= 32'h00a42820; 9 | RAM[8] <= 32'hac050004; 10 | RAM[9] <= 32'h00000000; 11 | RAM[10] <= 32'h00000000; 12 | RAM[11] <= 32'h00000000; 13 | -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/en & clear/en & clear.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20020005; 2 | RAM[1] <= 32'h2003000c; 3 | RAM[2] <= 32'h2067fff7; 4 | RAM[3] <= 32'h00e22025; 5 | RAM[4] <= 32'h00642824; 6 | RAM[5] <= 32'h00a42820; 7 | RAM[6] <= 32'h14050001; 8 | RAM[7] <= 32'h00a42820; 9 | RAM[8] <= 32'hac050004; 10 | RAM[9] <= 32'h00000000; 11 | RAM[10] <= 32'h00000000; 12 | RAM[11] <= 32'h00000000; 13 | -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/quick multiply/quick multiply.in: -------------------------------------------------------------------------------- 1 | addi $t0, $0, 99 2 | addi $t1, $0, 37 3 | addi $s0, $0, 0 4 | addi $a0, $0, 0 5 | while: 6 | beq $t1, $0, done 7 | andi $t2, $t1, 1 8 | beq $t2, $0, target 9 | add $s0, $s0, $t0 10 | sw $s0, 0($a0) 11 | addi $a0, $a0, 4 12 | target: 13 | sll $t0, $t0, 1 14 | srl $t1, $t1, 1 15 | j while 16 | done: 17 | nop 18 | nop 19 | nop 20 | nop -------------------------------------------------------------------------------- /assignment-2/check.sh: -------------------------------------------------------------------------------- 1 | unzip -oq $1 2 | stuId=$(grep -o "^[0-9]*" <<< $1) 3 | if [ ! -d $stuId ]; then 4 | echo 解压缩文件中需要包一层 $stuId/ 文件夹 5 | else 6 | cd $stuId 7 | if [ ! -d Pipeline ]; then 8 | echo 项目名为 Pipeline 9 | else 10 | cd Pipeline 11 | if [ ! -f makefile ]; then 12 | echo 添加 makefile 13 | elif [ ! -d benchtest ]; then 14 | echo 添加 benchtest 15 | fi 16 | fi 17 | fi 18 | -------------------------------------------------------------------------------- /assignment-2/benchtest/testjr/testjr.run: -------------------------------------------------------------------------------- 1 | [0x00000040]=0x00000064 2 | [0x00000038]=0x00000064 3 | [0x00000000]=0x00000064 4 | [0x00000008]=0x0000006c 5 | [0x00000030]=0x00000064 6 | [0x00000010]=0x00000090 7 | [0x00000028]=0x00000064 8 | [0x00000000]=0x00000006 9 | [0x00000004]=0x0000000c 10 | [0x00000000]=0x000000dc 11 | [0x00000004]=0x000000f0 12 | [0x00000018]=0x00000000 13 | [0x0000000c]=0x000000ec -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/testjr/testjr.run: -------------------------------------------------------------------------------- 1 | [0x00000040]=0x00000064 2 | [0x00000038]=0x00000064 3 | [0x00000000]=0x00000064 4 | [0x00000008]=0x0000006c 5 | [0x00000030]=0x00000064 6 | [0x00000010]=0x00000090 7 | [0x00000028]=0x00000064 8 | [0x00000000]=0x00000006 9 | [0x00000004]=0x0000000c 10 | [0x00000000]=0x000000dc 11 | [0x00000004]=0x000000f0 12 | [0x00000018]=0x00000000 13 | [0x0000000c]=0x000000ec -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/writeback/writeback.out: -------------------------------------------------------------------------------- 1 | 0x0 : add $a0, $0, $0 | 00002020 2 | 0x4 : addi $a2, $0, 512 | 20060200 3 | 0x8 : start: | 4 | 0x8 : lw $a1, 0($a0) | 8c850000 5 | 0xc : addi $a0, $a0, 8 | 20840008 6 | 0x10 : bne $a0, $a2, start | 14c4fffd 7 | 0x14 : nop | 00000000 8 | 0x18 : nop | 00000000 9 | 0x1c : nop | 00000000 -------------------------------------------------------------------------------- /assignment-1/benchtest/bisection/bisection.in: -------------------------------------------------------------------------------- 1 | addi $v0, $0, 44 2 | addi $a0, $0, 0 3 | addi $a1, $0, 31 4 | addi $s0, $0, 128 5 | mid: 6 | add $a2, $a0, $a1 7 | sra $a2, $a2, 1 8 | sw $a2, 0($s0) 9 | addi $s0, $s0, 4 10 | sll $a3, $a2, 2 11 | lw $v1, 0($a3) 12 | slt $s1, $v1, $v0 13 | bne $s1, $0, less 14 | beq $v0, $v1, exit 15 | add $a1, $a2, $0 16 | j mid 17 | less: 18 | add $a0, $a2, $0 19 | j mid 20 | exit: 21 | nop -------------------------------------------------------------------------------- /assignment-2/benchtest/factorial/factorial.mem: -------------------------------------------------------------------------------- 1 | 201d0080 2 | 20040005 3 | 20050000 4 | 0c00000a 5 | aca20000 6 | 00021040 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 23bdfff8 12 | afa40004 13 | afbf0000 14 | 20080002 15 | 0088402a 16 | 10080003 17 | 20020001 18 | 23bd0008 19 | 03e00008 20 | 2084ffff 21 | 0c00000a 22 | 8fbf0000 23 | 8fa40004 24 | 23bd0008 25 | aca20000 26 | 00821020 27 | 20a50004 28 | 03e00008 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/factorial/factorial.mem: -------------------------------------------------------------------------------- 1 | 201d0080 2 | 20040005 3 | 20050000 4 | 0c00000a 5 | aca20000 6 | 00021040 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 23bdfff8 12 | afa40004 13 | afbf0000 14 | 20080002 15 | 0088402a 16 | 10080003 17 | 20020001 18 | 23bd0008 19 | 03e00008 20 | 2084ffff 21 | 0c00000a 22 | 8fbf0000 23 | 8fa40004 24 | 23bd0008 25 | aca20000 26 | 00821020 27 | 20a50004 28 | 03e00008 -------------------------------------------------------------------------------- /assignment-1/benchtest/run_simulation.tcl: -------------------------------------------------------------------------------- 1 | update_compile_order -fileset sources_1 2 | 3 | set simulations [get_fileset $env(SIMULATION)] 4 | 5 | if { [llength simulations] != 0} { 6 | foreach sim $simulations { 7 | update_compile_order -fileset $sim 8 | launch_simulation -simset $sim 9 | # make simulation complete 10 | run all 11 | } 12 | } 13 | 14 | exit 15 | -------------------------------------------------------------------------------- /assignment-2/benchtest/run_simulation.tcl: -------------------------------------------------------------------------------- 1 | update_compile_order -fileset sources_1 2 | 3 | set simulations [get_fileset $env(SIMULATION)] 4 | 5 | if { [llength simulations] != 0} { 6 | foreach sim $simulations { 7 | update_compile_order -fileset $sim 8 | launch_simulation -simset $sim 9 | # make simulation complete 10 | run all 11 | } 12 | } 13 | 14 | exit 15 | -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/run_simulation.tcl: -------------------------------------------------------------------------------- 1 | update_compile_order -fileset sources_1 2 | 3 | set simulations [get_fileset $env(SIMULATION)] 4 | 5 | if { [llength simulations] != 0} { 6 | foreach sim $simulations { 7 | update_compile_order -fileset $sim 8 | launch_simulation -simset $sim 9 | # make simulation complete 10 | run all 11 | } 12 | } 13 | 14 | exit 15 | -------------------------------------------------------------------------------- /assignment-1/benchtest/bubble sort/bubble sort.in: -------------------------------------------------------------------------------- 1 | add $t0, $0, $0 2 | addi $t3, $0, 128 3 | For: 4 | add $sp, $0, $t0 5 | lw $t4, 0($sp) 6 | add $t5, $0, $sp 7 | for: 8 | lw $t6, 0($sp) 9 | slt $t7, $t6, $t4 10 | bne $t7, $0, ret 11 | add $t4, $0, $t6 12 | add $t5, $sp, $0 13 | ret: 14 | addi $sp, $sp, 4 15 | bne $sp, $t3, for 16 | addi $t3, $t3, -4 17 | lw $t8, 0($t3) 18 | sw $t4, 0($t3) 19 | sw $t8, 0($t5) 20 | bne $0, $t3, For 21 | nop -------------------------------------------------------------------------------- /assignment-1/benchtest/quick multiply/quick multiply.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20080063; 2 | RAM[1] <= 32'h20090025; 3 | RAM[2] <= 32'h20100000; 4 | RAM[3] <= 32'h20040000; 5 | RAM[4] <= 32'h10090008; 6 | RAM[5] <= 32'h312a0001; 7 | RAM[6] <= 32'h100a0003; 8 | RAM[7] <= 32'h02088020; 9 | RAM[8] <= 32'hac900000; 10 | RAM[9] <= 32'h20840004; 11 | RAM[10] <= 32'h00084040; 12 | RAM[11] <= 32'h00094842; 13 | RAM[12] <= 32'h08000004; 14 | RAM[13] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-2/benchtest/bisection/bisection.in: -------------------------------------------------------------------------------- 1 | addi $v0, $0, 44 2 | addi $a0, $0, 0 3 | addi $a1, $0, 31 4 | addi $s0, $0, 128 5 | mid: 6 | add $a2, $a0, $a1 7 | sra $a2, $a2, 1 8 | sw $a2, 0($s0) 9 | addi $s0, $s0, 4 10 | sll $a3, $a2, 2 11 | lw $v1, 0($a3) 12 | slt $s1, $v1, $v0 13 | bne $s1, $0, less 14 | beq $v0, $v1, exit 15 | add $a1, $a2, $0 16 | j mid 17 | less: 18 | add $a0, $a2, $0 19 | j mid 20 | exit: 21 | nop 22 | nop 23 | nop 24 | nop -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bisection/bisection.in: -------------------------------------------------------------------------------- 1 | addi $v0, $0, 44 2 | addi $a0, $0, 0 3 | addi $a1, $0, 31 4 | addi $s0, $0, 128 5 | mid: 6 | add $a2, $a0, $a1 7 | sra $a2, $a2, 1 8 | sw $a2, 0($s0) 9 | addi $s0, $s0, 4 10 | sll $a3, $a2, 2 11 | lw $v1, 0($a3) 12 | slt $s1, $v1, $v0 13 | bne $s1, $0, less 14 | beq $v0, $v1, exit 15 | add $a1, $a2, $0 16 | j mid 17 | less: 18 | add $a0, $a2, $0 19 | j mid 20 | exit: 21 | nop 22 | nop 23 | nop 24 | nop -------------------------------------------------------------------------------- /assignment-1/benchtest/ad hoc/ad hoc.in: -------------------------------------------------------------------------------- 1 | main: 2 | addi $v0, $0, 5 3 | addi $v1, $0, 12 4 | addi $a3, $v1, -9 5 | or $a0, $a3, $v0 6 | and $a1, $v1, $a0 7 | add $a1, $a1, $a0 8 | beq $a3, $a1, end 9 | slt $a0, $v1, $a0 10 | beq $0, $a0, around 11 | addi $a1, $0, 0 12 | around: 13 | slt $a0, $a3, $v0 14 | add $a3, $a0, $a1 15 | sub $a3, $a3, $v0 16 | sw $a3, 68($v1) 17 | lw $v0, 80($0) 18 | j end 19 | addi $v0, $0, 1 20 | end: 21 | sw $v0, 84($0) 22 | nop -------------------------------------------------------------------------------- /assignment-1/benchtest/gcd/gcd.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h200200bd; 2 | RAM[1] <= 32'h2003011f; 3 | RAM[2] <= 32'h00002020; 4 | RAM[3] <= 32'hac820000; 5 | RAM[4] <= 32'hac830004; 6 | RAM[5] <= 32'h20840008; 7 | RAM[6] <= 32'h10620007; 8 | RAM[7] <= 32'h0043082a; 9 | RAM[8] <= 32'h10010003; 10 | RAM[9] <= 32'h00400820; 11 | RAM[10] <= 32'h00601020; 12 | RAM[11] <= 32'h00201820; 13 | RAM[12] <= 32'h00431022; 14 | RAM[13] <= 32'h08000003; 15 | RAM[14] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-1/benchtest/factorial/factorial.run: -------------------------------------------------------------------------------- 1 | [0x0000007c]=0x00000005 2 | [0x00000078]=0x00000010 3 | [0x00000074]=0x00000004 4 | [0x00000070]=0x00000048 5 | [0x0000006c]=0x00000003 6 | [0x00000068]=0x00000048 7 | [0x00000064]=0x00000002 8 | [0x00000060]=0x00000048 9 | [0x0000005c]=0x00000001 10 | [0x00000058]=0x00000048 11 | [0x00000000]=0x00000001 12 | [0x00000004]=0x00000003 13 | [0x00000008]=0x00000006 14 | [0x0000000c]=0x0000000a 15 | [0x00000010]=0x0000000f -------------------------------------------------------------------------------- /assignment-2/benchtest/bubble sort/bubble sort.in: -------------------------------------------------------------------------------- 1 | add $t0, $0, $0 2 | addi $t3, $0, 128 3 | For: 4 | add $sp, $0, $t0 5 | lw $t4, 0($sp) 6 | add $t5, $0, $sp 7 | for: 8 | lw $t6, 0($sp) 9 | slt $t7, $t6, $t4 10 | bne $t7, $0, ret 11 | add $t4, $0, $t6 12 | add $t5, $sp, $0 13 | ret: 14 | addi $sp, $sp, 4 15 | bne $sp, $t3, for 16 | addi $t3, $t3, -4 17 | lw $t8, 0($t3) 18 | sw $t4, 0($t3) 19 | sw $t8, 0($t5) 20 | bne $0, $t3, For 21 | nop 22 | nop 23 | nop 24 | nop -------------------------------------------------------------------------------- /assignment-2/benchtest/factorial/factorial.run: -------------------------------------------------------------------------------- 1 | [0x0000007c]=0x00000005 2 | [0x00000078]=0x00000010 3 | [0x00000074]=0x00000004 4 | [0x00000070]=0x00000054 5 | [0x0000006c]=0x00000003 6 | [0x00000068]=0x00000054 7 | [0x00000064]=0x00000002 8 | [0x00000060]=0x00000054 9 | [0x0000005c]=0x00000001 10 | [0x00000058]=0x00000054 11 | [0x00000000]=0x00000001 12 | [0x00000004]=0x00000003 13 | [0x00000008]=0x00000006 14 | [0x0000000c]=0x0000000a 15 | [0x00000010]=0x0000000f -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bubble sort/bubble sort.in: -------------------------------------------------------------------------------- 1 | add $t0, $0, $0 2 | addi $t3, $0, 128 3 | For: 4 | add $sp, $0, $t0 5 | lw $t4, 0($sp) 6 | add $t5, $0, $sp 7 | for: 8 | lw $t6, 0($sp) 9 | slt $t7, $t6, $t4 10 | bne $t7, $0, ret 11 | add $t4, $0, $t6 12 | add $t5, $sp, $0 13 | ret: 14 | addi $sp, $sp, 4 15 | bne $sp, $t3, for 16 | addi $t3, $t3, -4 17 | lw $t8, 0($t3) 18 | sw $t4, 0($t3) 19 | sw $t8, 0($t5) 20 | bne $0, $t3, For 21 | nop 22 | nop 23 | nop 24 | nop -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/factorial/factorial.run: -------------------------------------------------------------------------------- 1 | [0x0000007c]=0x00000005 2 | [0x00000078]=0x00000010 3 | [0x00000074]=0x00000004 4 | [0x00000070]=0x00000054 5 | [0x0000006c]=0x00000003 6 | [0x00000068]=0x00000054 7 | [0x00000064]=0x00000002 8 | [0x00000060]=0x00000054 9 | [0x0000005c]=0x00000001 10 | [0x00000058]=0x00000054 11 | [0x00000000]=0x00000001 12 | [0x00000004]=0x00000003 13 | [0x00000008]=0x00000006 14 | [0x0000000c]=0x0000000a 15 | [0x00000010]=0x0000000f -------------------------------------------------------------------------------- /assignment-1/benchtest/bisection/bisection.data: -------------------------------------------------------------------------------- 1 | 00000001 2 | 00000002 3 | 00000007 4 | 00000007 5 | 00000008 6 | 00000009 7 | 0000000d 8 | 00000012 9 | 00000019 10 | 0000001b 11 | 0000001c 12 | 0000001d 13 | 0000001f 14 | 00000024 15 | 00000026 16 | 00000027 17 | 00000028 18 | 0000002c 19 | 00000030 20 | 00000034 21 | 0000003e 22 | 00000042 23 | 00000044 24 | 00000046 25 | 00000049 26 | 0000004a 27 | 0000004a 28 | 0000004b 29 | 0000004b 30 | 00000051 31 | 00000052 32 | 0000005f -------------------------------------------------------------------------------- /assignment-1/benchtest/gcd/gcd.ans: -------------------------------------------------------------------------------- 1 | 00000038 2 | 000000bd 3 | 0000011f 4 | 00000062 5 | 000000bd 6 | 0000005b 7 | 00000062 8 | 00000007 9 | 0000005b 10 | 00000054 11 | 00000007 12 | 0000004d 13 | 00000007 14 | 00000046 15 | 00000007 16 | 0000003f 17 | 00000007 18 | 00000038 19 | 00000007 20 | 00000031 21 | 00000007 22 | 0000002a 23 | 00000007 24 | 00000023 25 | 00000007 26 | 0000001c 27 | 00000007 28 | 00000015 29 | 00000007 30 | 0000000e 31 | 00000007 32 | 00000007 33 | 00000007 -------------------------------------------------------------------------------- /assignment-2/benchtest/ad hoc/ad hoc.in: -------------------------------------------------------------------------------- 1 | main: 2 | addi $v0, $0, 5 3 | addi $v1, $0, 12 4 | addi $a3, $v1, -9 5 | or $a0, $a3, $v0 6 | and $a1, $v1, $a0 7 | add $a1, $a1, $a0 8 | beq $a3, $a1, end 9 | slt $a0, $v1, $a0 10 | beq $0, $a0, around 11 | addi $a1, $0, 0 12 | around: 13 | slt $a0, $a3, $v0 14 | add $a3, $a0, $a1 15 | sub $a3, $a3, $v0 16 | sw $a3, 68($v1) 17 | lw $v0, 80($0) 18 | j end 19 | addi $v0, $0, 1 20 | end: 21 | sw $v0, 84($0) 22 | nop 23 | nop 24 | nop 25 | nop -------------------------------------------------------------------------------- /assignment-2/benchtest/bisection/bisection.data: -------------------------------------------------------------------------------- 1 | 00000001 2 | 00000002 3 | 00000007 4 | 00000007 5 | 00000008 6 | 00000009 7 | 0000000d 8 | 00000012 9 | 00000019 10 | 0000001b 11 | 0000001c 12 | 0000001d 13 | 0000001f 14 | 00000024 15 | 00000026 16 | 00000027 17 | 00000028 18 | 0000002c 19 | 00000030 20 | 00000034 21 | 0000003e 22 | 00000042 23 | 00000044 24 | 00000046 25 | 00000049 26 | 0000004a 27 | 0000004a 28 | 0000004b 29 | 0000004b 30 | 00000051 31 | 00000052 32 | 0000005f -------------------------------------------------------------------------------- /assignment-2/benchtest/gcd/gcd.ans: -------------------------------------------------------------------------------- 1 | 00000044 2 | 000000bd 3 | 0000011f 4 | 00000062 5 | 000000bd 6 | 0000005b 7 | 00000062 8 | 00000007 9 | 0000005b 10 | 00000054 11 | 00000007 12 | 0000004d 13 | 00000007 14 | 00000046 15 | 00000007 16 | 0000003f 17 | 00000007 18 | 00000038 19 | 00000007 20 | 00000031 21 | 00000007 22 | 0000002a 23 | 00000007 24 | 00000023 25 | 00000007 26 | 0000001c 27 | 00000007 28 | 00000015 29 | 00000007 30 | 0000000e 31 | 00000007 32 | 00000007 33 | 00000007 -------------------------------------------------------------------------------- /assignment-2/benchtest/mutual recursion/mutual recursion.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x00000066 2 | [0x00000004]=0x00000067 3 | [0x00000008]=0x00000066 4 | [0x0000000c]=0x00000067 5 | [0x00000010]=0x00000061 6 | [0x0000007c]=0x00000000 7 | [0x00000078]=0x00000038 8 | [0x00000074]=0x00000001 9 | [0x00000070]=0x00000084 10 | [0x0000006c]=0x00000002 11 | [0x00000068]=0x000000c4 12 | [0x00000064]=0x00000003 13 | [0x00000060]=0x00000084 14 | [0x0000005c]=0x00000004 15 | [0x00000058]=0x000000c4 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bisection/bisection.data: -------------------------------------------------------------------------------- 1 | 00000001 2 | 00000002 3 | 00000007 4 | 00000007 5 | 00000008 6 | 00000009 7 | 0000000d 8 | 00000012 9 | 00000019 10 | 0000001b 11 | 0000001c 12 | 0000001d 13 | 0000001f 14 | 00000024 15 | 00000026 16 | 00000027 17 | 00000028 18 | 0000002c 19 | 00000030 20 | 00000034 21 | 0000003e 22 | 00000042 23 | 00000044 24 | 00000046 25 | 00000049 26 | 0000004a 27 | 0000004a 28 | 0000004b 29 | 0000004b 30 | 00000051 31 | 00000052 32 | 0000005f -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/mutual recursion/mutual recursion.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x00000066 2 | [0x00000004]=0x00000067 3 | [0x00000008]=0x00000066 4 | [0x0000000c]=0x00000067 5 | [0x00000010]=0x00000061 6 | [0x0000007c]=0x00000000 7 | [0x00000078]=0x00000038 8 | [0x00000074]=0x00000001 9 | [0x00000070]=0x00000084 10 | [0x0000006c]=0x00000002 11 | [0x00000068]=0x000000c4 12 | [0x00000064]=0x00000003 13 | [0x00000060]=0x00000084 14 | [0x0000005c]=0x00000004 15 | [0x00000058]=0x000000c4 -------------------------------------------------------------------------------- /assignment-3(I)/src/cache.vh: -------------------------------------------------------------------------------- 1 | `ifndef CACHE_VH 2 | `define CACHE_VH 3 | 4 | `timescale 1ns / 1ps 5 | 6 | `define ADDR_WIDTH 32 7 | 8 | // tag bits 9 | `define CACHE_T 26 10 | // set index bits 11 | `define CACHE_S 2 12 | // block offset bits 13 | `define CACHE_B 4 14 | // The sum of above bits should be 32 (ADDR_WIDTH) 15 | 16 | // number of lines per set 17 | `define CACHE_E 4 18 | 19 | `define SET_NUM 2**`CACHE_S 20 | `define BLOCK_SIZE 2**`CACHE_B 21 | 22 | `endif 23 | -------------------------------------------------------------------------------- /assignment-1/benchtest/bubble sort/bubble sort.data: -------------------------------------------------------------------------------- 1 | 00000007 2 | 00000034 3 | 0000005f 4 | 00000052 5 | 0000004a 6 | 00000042 7 | 00000001 8 | 0000001b 9 | 00000051 10 | 00000009 11 | 00000002 12 | 0000001c 13 | 0000001f 14 | 00000049 15 | 0000001d 16 | 00000027 17 | 00000046 18 | 00000044 19 | 00000019 20 | 0000002c 21 | 0000004b 22 | 00000030 23 | 0000004b 24 | 00000007 25 | 00000028 26 | 0000003e 27 | 00000012 28 | 0000000d 29 | 00000008 30 | 00000024 31 | 00000026 32 | 0000004a -------------------------------------------------------------------------------- /assignment-2/benchtest/bubble sort/bubble sort.data: -------------------------------------------------------------------------------- 1 | 00000007 2 | 00000034 3 | 0000005f 4 | 00000052 5 | 0000004a 6 | 00000042 7 | 00000001 8 | 0000001b 9 | 00000051 10 | 00000009 11 | 00000002 12 | 0000001c 13 | 0000001f 14 | 00000049 15 | 0000001d 16 | 00000027 17 | 00000046 18 | 00000044 19 | 00000019 20 | 0000002c 21 | 0000004b 22 | 00000030 23 | 0000004b 24 | 00000007 25 | 00000028 26 | 0000003e 27 | 00000012 28 | 0000000d 29 | 00000008 30 | 00000024 31 | 00000026 32 | 0000004a -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/ad hoc/ad hoc.in: -------------------------------------------------------------------------------- 1 | main: 2 | addi $v0, $0, 5 3 | addi $v1, $0, 12 4 | addi $a3, $v1, -9 5 | or $a0, $a3, $v0 6 | and $a1, $v1, $a0 7 | add $a1, $a1, $a0 8 | beq $a3, $a1, end 9 | slt $a0, $v1, $a0 10 | beq $0, $a0, around 11 | addi $a1, $0, 0 12 | around: 13 | slt $a0, $a3, $v0 14 | add $a3, $a0, $a1 15 | sub $a3, $a3, $v0 16 | sw $a3, 68($v1) 17 | lw $v0, 80($0) 18 | j end 19 | addi $v0, $0, 1 20 | end: 21 | sw $v0, 84($0) 22 | nop 23 | nop 24 | nop 25 | nop -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bubble sort/bubble sort.data: -------------------------------------------------------------------------------- 1 | 00000007 2 | 00000034 3 | 0000005f 4 | 00000052 5 | 0000004a 6 | 00000042 7 | 00000001 8 | 0000001b 9 | 00000051 10 | 00000009 11 | 00000002 12 | 0000001c 13 | 0000001f 14 | 00000049 15 | 0000001d 16 | 00000027 17 | 00000046 18 | 00000044 19 | 00000019 20 | 0000002c 21 | 0000004b 22 | 00000030 23 | 0000004b 24 | 00000007 25 | 00000028 26 | 0000003e 27 | 00000012 28 | 0000000d 29 | 00000008 30 | 00000024 31 | 00000026 32 | 0000004a -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/gcd/gcd.ans: -------------------------------------------------------------------------------- 1 | 00000044 2 | 000000bd 3 | 0000011f 4 | 00000062 5 | 000000bd 6 | 0000005b 7 | 00000062 8 | 00000007 9 | 0000005b 10 | 00000054 11 | 00000007 12 | 0000004d 13 | 00000007 14 | 00000046 15 | 00000007 16 | 0000003f 17 | 00000007 18 | 00000038 19 | 00000007 20 | 00000031 21 | 00000007 22 | 0000002a 23 | 00000007 24 | 00000023 25 | 00000007 26 | 0000001c 27 | 00000007 28 | 00000015 29 | 00000007 30 | 0000000e 31 | 00000007 32 | 00000007 33 | 00000007 -------------------------------------------------------------------------------- /assignment-1/benchtest/bubble sort/bubble sort.ans: -------------------------------------------------------------------------------- 1 | 00000044 2 | 00000001 3 | 00000002 4 | 00000007 5 | 00000007 6 | 00000008 7 | 00000009 8 | 0000000d 9 | 00000012 10 | 00000019 11 | 0000001b 12 | 0000001c 13 | 0000001d 14 | 0000001f 15 | 00000024 16 | 00000026 17 | 00000027 18 | 00000028 19 | 0000002c 20 | 00000030 21 | 00000034 22 | 0000003e 23 | 00000042 24 | 00000044 25 | 00000046 26 | 00000049 27 | 0000004a 28 | 0000004a 29 | 0000004b 30 | 0000004b 31 | 00000051 32 | 00000052 33 | 0000005f -------------------------------------------------------------------------------- /assignment-2/benchtest/bubble sort/bubble sort.ans: -------------------------------------------------------------------------------- 1 | 00000050 2 | 00000001 3 | 00000002 4 | 00000007 5 | 00000007 6 | 00000008 7 | 00000009 8 | 0000000d 9 | 00000012 10 | 00000019 11 | 0000001b 12 | 0000001c 13 | 0000001d 14 | 0000001f 15 | 00000024 16 | 00000026 17 | 00000027 18 | 00000028 19 | 0000002c 20 | 00000030 21 | 00000034 22 | 0000003e 23 | 00000042 24 | 00000044 25 | 00000046 26 | 00000049 27 | 0000004a 28 | 0000004a 29 | 0000004b 30 | 0000004b 31 | 00000051 32 | 00000052 33 | 0000005f -------------------------------------------------------------------------------- /assignment-1/benchtest/factorial/factorial.ans: -------------------------------------------------------------------------------- 1 | 00000018 2 | 00000001 3 | 00000003 4 | 00000006 5 | 0000000a 6 | 0000000f 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000000 13 | 00000000 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000000 23 | 00000000 24 | 00000048 25 | 00000001 26 | 00000048 27 | 00000002 28 | 00000048 29 | 00000003 30 | 00000048 31 | 00000004 32 | 00000010 33 | 00000005 34 | -------------------------------------------------------------------------------- /assignment-2/benchtest/factorial/factorial.ans: -------------------------------------------------------------------------------- 1 | 00000024 2 | 00000001 3 | 00000003 4 | 00000006 5 | 0000000a 6 | 0000000f 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000000 13 | 00000000 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000000 23 | 00000000 24 | 00000054 25 | 00000001 26 | 00000054 27 | 00000002 28 | 00000054 29 | 00000003 30 | 00000054 31 | 00000004 32 | 00000010 33 | 00000005 34 | -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bubble sort/bubble sort.ans: -------------------------------------------------------------------------------- 1 | 00000050 2 | 00000001 3 | 00000002 4 | 00000007 5 | 00000007 6 | 00000008 7 | 00000009 8 | 0000000d 9 | 00000012 10 | 00000019 11 | 0000001b 12 | 0000001c 13 | 0000001d 14 | 0000001f 15 | 00000024 16 | 00000026 17 | 00000027 18 | 00000028 19 | 0000002c 20 | 00000030 21 | 00000034 22 | 0000003e 23 | 00000042 24 | 00000044 25 | 00000046 26 | 00000049 27 | 0000004a 28 | 0000004a 29 | 0000004b 30 | 0000004b 31 | 00000051 32 | 00000052 33 | 0000005f -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/factorial/factorial.ans: -------------------------------------------------------------------------------- 1 | 00000024 2 | 00000001 3 | 00000003 4 | 00000006 5 | 0000000a 6 | 0000000f 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000000 13 | 00000000 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000000 23 | 00000000 24 | 00000054 25 | 00000001 26 | 00000054 27 | 00000002 28 | 00000054 29 | 00000003 30 | 00000054 31 | 00000004 32 | 00000010 33 | 00000005 34 | -------------------------------------------------------------------------------- /assignment-2/benchtest/mutual recursion/mutual recursion.ans: -------------------------------------------------------------------------------- 1 | 00000048 2 | 00000066 3 | 00000067 4 | 00000066 5 | 00000067 6 | 00000061 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000000 13 | 00000000 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000000 23 | 00000000 24 | 000000c4 25 | 00000004 26 | 00000084 27 | 00000003 28 | 000000c4 29 | 00000002 30 | 00000084 31 | 00000001 32 | 00000038 33 | 00000000 34 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/mutual recursion/mutual recursion.ans: -------------------------------------------------------------------------------- 1 | 00000048 2 | 00000066 3 | 00000067 4 | 00000066 5 | 00000067 6 | 00000061 7 | 00000000 8 | 00000000 9 | 00000000 10 | 00000000 11 | 00000000 12 | 00000000 13 | 00000000 14 | 00000000 15 | 00000000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 00000000 21 | 00000000 22 | 00000000 23 | 00000000 24 | 000000c4 25 | 00000004 26 | 00000084 27 | 00000003 28 | 000000c4 29 | 00000002 30 | 00000084 31 | 00000001 32 | 00000038 33 | 00000000 34 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/random write/random write.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20080011; 2 | RAM[1] <= 32'h20090020; 3 | RAM[2] <= 32'h200b0010; 4 | RAM[3] <= 32'h20100000; 5 | RAM[4] <= 32'h200a0000; 6 | RAM[5] <= 32'h02088020; 7 | RAM[6] <= 32'h320c007f; 8 | RAM[7] <= 32'h000c6080; 9 | RAM[8] <= 32'had880000; 10 | RAM[9] <= 32'h214a0001; 11 | RAM[10] <= 32'h156afffa; 12 | RAM[11] <= 32'h21080001; 13 | RAM[12] <= 32'h1528fff7; 14 | RAM[13] <= 32'h00000000; 15 | RAM[14] <= 32'h00000000; 16 | RAM[15] <= 32'h00000000; 17 | -------------------------------------------------------------------------------- /assignment-2/benchtest/quick multiply/quick multiply.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20080063; 2 | RAM[1] <= 32'h20090025; 3 | RAM[2] <= 32'h20100000; 4 | RAM[3] <= 32'h20040000; 5 | RAM[4] <= 32'h10090008; 6 | RAM[5] <= 32'h312a0001; 7 | RAM[6] <= 32'h100a0003; 8 | RAM[7] <= 32'h02088020; 9 | RAM[8] <= 32'hac900000; 10 | RAM[9] <= 32'h20840004; 11 | RAM[10] <= 32'h00084040; 12 | RAM[11] <= 32'h00094842; 13 | RAM[12] <= 32'h08000004; 14 | RAM[13] <= 32'h00000000; 15 | RAM[14] <= 32'h00000000; 16 | RAM[15] <= 32'h00000000; 17 | RAM[16] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/quick multiply/quick multiply.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20080063; 2 | RAM[1] <= 32'h20090025; 3 | RAM[2] <= 32'h20100000; 4 | RAM[3] <= 32'h20040000; 5 | RAM[4] <= 32'h10090008; 6 | RAM[5] <= 32'h312a0001; 7 | RAM[6] <= 32'h100a0003; 8 | RAM[7] <= 32'h02088020; 9 | RAM[8] <= 32'hac900000; 10 | RAM[9] <= 32'h20840004; 11 | RAM[10] <= 32'h00084040; 12 | RAM[11] <= 32'h00094842; 13 | RAM[12] <= 32'h08000004; 14 | RAM[13] <= 32'h00000000; 15 | RAM[14] <= 32'h00000000; 16 | RAM[15] <= 32'h00000000; 17 | RAM[16] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-1/benchtest/bisection/bisection.ans: -------------------------------------------------------------------------------- 1 | 00000044 2 | 00000001 3 | 00000002 4 | 00000007 5 | 00000007 6 | 00000008 7 | 00000009 8 | 0000000d 9 | 00000012 10 | 00000019 11 | 0000001b 12 | 0000001c 13 | 0000001d 14 | 0000001f 15 | 00000024 16 | 00000026 17 | 00000027 18 | 00000028 19 | 0000002c 20 | 00000030 21 | 00000034 22 | 0000003e 23 | 00000042 24 | 00000044 25 | 00000046 26 | 00000049 27 | 0000004a 28 | 0000004a 29 | 0000004b 30 | 0000004b 31 | 00000051 32 | 00000052 33 | 0000005f 34 | 0000000f 35 | 00000017 36 | 00000013 37 | 00000011 -------------------------------------------------------------------------------- /assignment-2/benchtest/bisection/bisection.ans: -------------------------------------------------------------------------------- 1 | 00000050 2 | 00000001 3 | 00000002 4 | 00000007 5 | 00000007 6 | 00000008 7 | 00000009 8 | 0000000d 9 | 00000012 10 | 00000019 11 | 0000001b 12 | 0000001c 13 | 0000001d 14 | 0000001f 15 | 00000024 16 | 00000026 17 | 00000027 18 | 00000028 19 | 0000002c 20 | 00000030 21 | 00000034 22 | 0000003e 23 | 00000042 24 | 00000044 25 | 00000046 26 | 00000049 27 | 0000004a 28 | 0000004a 29 | 0000004b 30 | 0000004b 31 | 00000051 32 | 00000052 33 | 0000005f 34 | 0000000f 35 | 00000017 36 | 00000013 37 | 00000011 -------------------------------------------------------------------------------- /assignment-2/benchtest/gcd/gcd.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h200200bd; 2 | RAM[1] <= 32'h2003011f; 3 | RAM[2] <= 32'h00002020; 4 | RAM[3] <= 32'hac820000; 5 | RAM[4] <= 32'hac830004; 6 | RAM[5] <= 32'h20840008; 7 | RAM[6] <= 32'h10620007; 8 | RAM[7] <= 32'h0043082a; 9 | RAM[8] <= 32'h10010003; 10 | RAM[9] <= 32'h00400820; 11 | RAM[10] <= 32'h00601020; 12 | RAM[11] <= 32'h00201820; 13 | RAM[12] <= 32'h00431022; 14 | RAM[13] <= 32'h08000003; 15 | RAM[14] <= 32'h00000000; 16 | RAM[15] <= 32'h00000000; 17 | RAM[16] <= 32'h00000000; 18 | RAM[17] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bisection/bisection.ans: -------------------------------------------------------------------------------- 1 | 00000050 2 | 00000001 3 | 00000002 4 | 00000007 5 | 00000007 6 | 00000008 7 | 00000009 8 | 0000000d 9 | 00000012 10 | 00000019 11 | 0000001b 12 | 0000001c 13 | 0000001d 14 | 0000001f 15 | 00000024 16 | 00000026 17 | 00000027 18 | 00000028 19 | 0000002c 20 | 00000030 21 | 00000034 22 | 0000003e 23 | 00000042 24 | 00000044 25 | 00000046 26 | 00000049 27 | 0000004a 28 | 0000004a 29 | 0000004b 30 | 0000004b 31 | 00000051 32 | 00000052 33 | 0000005f 34 | 0000000f 35 | 00000017 36 | 00000013 37 | 00000011 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/gcd/gcd.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h200200bd; 2 | RAM[1] <= 32'h2003011f; 3 | RAM[2] <= 32'h00002020; 4 | RAM[3] <= 32'hac820000; 5 | RAM[4] <= 32'hac830004; 6 | RAM[5] <= 32'h20840008; 7 | RAM[6] <= 32'h10620007; 8 | RAM[7] <= 32'h0043082a; 9 | RAM[8] <= 32'h10010003; 10 | RAM[9] <= 32'h00400820; 11 | RAM[10] <= 32'h00601020; 12 | RAM[11] <= 32'h00201820; 13 | RAM[12] <= 32'h00431022; 14 | RAM[13] <= 32'h08000003; 15 | RAM[14] <= 32'h00000000; 16 | RAM[15] <= 32'h00000000; 17 | RAM[16] <= 32'h00000000; 18 | RAM[17] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-2/benchtest/i-type/i-type.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20180771; 2 | RAM[1] <= 32'h2019f81c; 3 | RAM[2] <= 32'h2b11f81c; 4 | RAM[3] <= 32'hac110000; 5 | RAM[4] <= 32'h2b3107e4; 6 | RAM[5] <= 32'hac110004; 7 | RAM[6] <= 32'h3331ffff; 8 | RAM[7] <= 32'hac110008; 9 | RAM[8] <= 32'h33317fff; 10 | RAM[9] <= 32'hac11000c; 11 | RAM[10] <= 32'h3711fff8; 12 | RAM[11] <= 32'hac110010; 13 | RAM[12] <= 32'h373107e4; 14 | RAM[13] <= 32'hac110014; 15 | RAM[14] <= 32'h00000000; 16 | RAM[15] <= 32'h00000000; 17 | RAM[16] <= 32'h00000000; 18 | RAM[17] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/i-type/i-type.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20180771; 2 | RAM[1] <= 32'h2019f81c; 3 | RAM[2] <= 32'h2b11f81c; 4 | RAM[3] <= 32'hac110000; 5 | RAM[4] <= 32'h2b3107e4; 6 | RAM[5] <= 32'hac110004; 7 | RAM[6] <= 32'h3331ffff; 8 | RAM[7] <= 32'hac110008; 9 | RAM[8] <= 32'h33317fff; 10 | RAM[9] <= 32'hac11000c; 11 | RAM[10] <= 32'h3711fff8; 12 | RAM[11] <= 32'hac110010; 13 | RAM[12] <= 32'h373107e4; 14 | RAM[13] <= 32'hac110014; 15 | RAM[14] <= 32'h00000000; 16 | RAM[15] <= 32'h00000000; 17 | RAM[16] <= 32'h00000000; 18 | RAM[17] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-1/benchtest/bisection/bisection.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h2002002c; 2 | RAM[1] <= 32'h20040000; 3 | RAM[2] <= 32'h2005001f; 4 | RAM[3] <= 32'h20100080; 5 | RAM[4] <= 32'h00853020; 6 | RAM[5] <= 32'h00063043; 7 | RAM[6] <= 32'hae060000; 8 | RAM[7] <= 32'h22100004; 9 | RAM[8] <= 32'h00063880; 10 | RAM[9] <= 32'h8ce30000; 11 | RAM[10] <= 32'h0062882a; 12 | RAM[11] <= 32'h14110003; 13 | RAM[12] <= 32'h10620004; 14 | RAM[13] <= 32'h00c02820; 15 | RAM[14] <= 32'h08000004; 16 | RAM[15] <= 32'h00c02020; 17 | RAM[16] <= 32'h08000004; 18 | RAM[17] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-1/benchtest/testzeroext/testzeroext.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $a0, $0, -1 | 2004ffff 2 | 0x4 : addi $a1, $0, 0 | 20050000 3 | 0x8 : addi $sp, $0, 32 | 201d0020 4 | 0xc : andi $a0, $a0, -1 | 3084ffff 5 | 0x10 : ori $a1, $a1, -1 | 34a5ffff 6 | 0x14 : sw $a0, 0($sp) | afa40000 7 | 0x18 : sw $a1, 8($sp) | afa50008 8 | 0x1c : nop | 00000000 9 | 0x20 : nop | 00000000 10 | 0x24 : nop | 00000000 11 | 0x28 : nop | 00000000 12 | 0x2c : nop | 13 | -------------------------------------------------------------------------------- /assignment-1/benchtest/bubble sort/bubble sort.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h00004020; 2 | RAM[1] <= 32'h200b0080; 3 | RAM[2] <= 32'h0008e820; 4 | RAM[3] <= 32'h8fac0000; 5 | RAM[4] <= 32'h001d6820; 6 | RAM[5] <= 32'h8fae0000; 7 | RAM[6] <= 32'h01cc782a; 8 | RAM[7] <= 32'h140f0002; 9 | RAM[8] <= 32'h000e6020; 10 | RAM[9] <= 32'h03a06820; 11 | RAM[10] <= 32'h23bd0004; 12 | RAM[11] <= 32'h157dfff9; 13 | RAM[12] <= 32'h216bfffc; 14 | RAM[13] <= 32'h8d780000; 15 | RAM[14] <= 32'had6c0000; 16 | RAM[15] <= 32'hadb80000; 17 | RAM[16] <= 32'h1560fff1; 18 | RAM[17] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-1/benchtest/factorial/factorial.in: -------------------------------------------------------------------------------- 1 | addi $sp, $0, 128 2 | addi $a0, $0, 5 3 | addi $a1, $0, 0 4 | jal factorial 5 | sw $v0, 0($a1) 6 | sll $v0, $v0, 1 7 | nop 8 | 9 | factorial: 10 | addi $sp, $sp, -8 11 | sw $a0, 4($sp) 12 | sw $ra, 0($sp) 13 | addi $t0, $0, 2 14 | slt $t0, $a0, $t0 15 | beq $t0, $0 ,else 16 | addi $v0, $0, 1 17 | addi $sp, $sp, 8 18 | jr $ra 19 | else: 20 | addi $a0, $a0, -1 21 | jal factorial 22 | lw $ra, 0($sp) 23 | lw $a0, 4($sp) 24 | addi $sp, $sp, 8 25 | sw $v0, 0($a1) 26 | add $v0, $a0, $v0 27 | addi $a1, $a1, 4 28 | jr $ra -------------------------------------------------------------------------------- /assignment-1/benchtest/ad hoc/ad hoc.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20020005; 2 | RAM[1] <= 32'h2003000c; 3 | RAM[2] <= 32'h2067fff7; 4 | RAM[3] <= 32'h00e22025; 5 | RAM[4] <= 32'h00642824; 6 | RAM[5] <= 32'h00a42820; 7 | RAM[6] <= 32'h10a7000a; 8 | RAM[7] <= 32'h0064202a; 9 | RAM[8] <= 32'h10800001; 10 | RAM[9] <= 32'h20050000; 11 | RAM[10] <= 32'h00e2202a; 12 | RAM[11] <= 32'h00853820; 13 | RAM[12] <= 32'h00e23822; 14 | RAM[13] <= 32'hac670044; 15 | RAM[14] <= 32'h8c020050; 16 | RAM[15] <= 32'h08000011; 17 | RAM[16] <= 32'h20020001; 18 | RAM[17] <= 32'hac020054; 19 | RAM[18] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-2/benchtest/factorial/factorial.in: -------------------------------------------------------------------------------- 1 | addi $sp, $0, 128 2 | addi $a0, $0, 5 3 | addi $a1, $0, 0 4 | jal factorial 5 | sw $v0, 0($a1) 6 | sll $v0, $v0, 1 7 | nop 8 | nop 9 | nop 10 | nop 11 | 12 | factorial: 13 | addi $sp, $sp, -8 14 | sw $a0, 4($sp) 15 | sw $ra, 0($sp) 16 | addi $t0, $0, 2 17 | slt $t0, $a0, $t0 18 | beq $t0, $0 ,else 19 | addi $v0, $0, 1 20 | addi $sp, $sp, 8 21 | jr $ra 22 | else: 23 | addi $a0, $a0, -1 24 | jal factorial 25 | lw $ra, 0($sp) 26 | lw $a0, 4($sp) 27 | addi $sp, $sp, 8 28 | sw $v0, 0($a1) 29 | add $v0, $a0, $v0 30 | addi $a1, $a1, 4 31 | jr $ra -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/factorial/factorial.in: -------------------------------------------------------------------------------- 1 | addi $sp, $0, 128 2 | addi $a0, $0, 5 3 | addi $a1, $0, 0 4 | jal factorial 5 | sw $v0, 0($a1) 6 | sll $v0, $v0, 1 7 | nop 8 | nop 9 | nop 10 | nop 11 | 12 | factorial: 13 | addi $sp, $sp, -8 14 | sw $a0, 4($sp) 15 | sw $ra, 0($sp) 16 | addi $t0, $0, 2 17 | slt $t0, $a0, $t0 18 | beq $t0, $0 ,else 19 | addi $v0, $0, 1 20 | addi $sp, $sp, 8 21 | jr $ra 22 | else: 23 | addi $a0, $a0, -1 24 | jal factorial 25 | lw $ra, 0($sp) 26 | lw $a0, 4($sp) 27 | addi $sp, $sp, 8 28 | sw $v0, 0($a1) 29 | add $v0, $a0, $v0 30 | addi $a1, $a1, 4 31 | jr $ra -------------------------------------------------------------------------------- /assignment-2/benchtest/en & clear/en & clear.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $v0, $0, 5 | 20020005 2 | 0x4 : addi $v1, $0, 12 | 2003000c 3 | 0x8 : addi $a3, $v1, -9 | 2067fff7 4 | 0xc : or $a0, $a3, $v0 | 00e22025 5 | 0x10 : and $a1, $v1, $a0 | 00642824 6 | 0x14 : add $a1, $a1, $a0 | 00a42820 7 | 0x18 : bne $a1, $0, around | 14050001 8 | 0x1c : add $a1, $a1, $a0 | 00a42820 9 | 0x20 : around: | 10 | 0x20 : sw $a1, 4($0) | ac050004 11 | 0x24 : nop | 00000000 12 | 0x28 : nop | 00000000 13 | 0x2c : nop | 00000000 14 | 0x30 : nop | 15 | -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/en & clear/en & clear.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $v0, $0, 5 | 20020005 2 | 0x4 : addi $v1, $0, 12 | 2003000c 3 | 0x8 : addi $a3, $v1, -9 | 2067fff7 4 | 0xc : or $a0, $a3, $v0 | 00e22025 5 | 0x10 : and $a1, $v1, $a0 | 00642824 6 | 0x14 : add $a1, $a1, $a0 | 00a42820 7 | 0x18 : bne $a1, $0, around | 14050001 8 | 0x1c : add $a1, $a1, $a0 | 00a42820 9 | 0x20 : around: | 10 | 0x20 : sw $a1, 4($0) | ac050004 11 | 0x24 : nop | 00000000 12 | 0x28 : nop | 00000000 13 | 0x2c : nop | 00000000 14 | 0x30 : nop | 15 | -------------------------------------------------------------------------------- /assignment-2/benchtest/bisection/bisection.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h2002002c; 2 | RAM[1] <= 32'h20040000; 3 | RAM[2] <= 32'h2005001f; 4 | RAM[3] <= 32'h20100080; 5 | RAM[4] <= 32'h00853020; 6 | RAM[5] <= 32'h00063043; 7 | RAM[6] <= 32'hae060000; 8 | RAM[7] <= 32'h22100004; 9 | RAM[8] <= 32'h00063880; 10 | RAM[9] <= 32'h8ce30000; 11 | RAM[10] <= 32'h0062882a; 12 | RAM[11] <= 32'h14110003; 13 | RAM[12] <= 32'h10620004; 14 | RAM[13] <= 32'h00c02820; 15 | RAM[14] <= 32'h08000004; 16 | RAM[15] <= 32'h00c02020; 17 | RAM[16] <= 32'h08000004; 18 | RAM[17] <= 32'h00000000; 19 | RAM[18] <= 32'h00000000; 20 | RAM[19] <= 32'h00000000; 21 | RAM[20] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-2/benchtest/bubble sort/bubble sort.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h00004020; 2 | RAM[1] <= 32'h200b0080; 3 | RAM[2] <= 32'h0008e820; 4 | RAM[3] <= 32'h8fac0000; 5 | RAM[4] <= 32'h001d6820; 6 | RAM[5] <= 32'h8fae0000; 7 | RAM[6] <= 32'h01cc782a; 8 | RAM[7] <= 32'h140f0002; 9 | RAM[8] <= 32'h000e6020; 10 | RAM[9] <= 32'h03a06820; 11 | RAM[10] <= 32'h23bd0004; 12 | RAM[11] <= 32'h157dfff9; 13 | RAM[12] <= 32'h216bfffc; 14 | RAM[13] <= 32'h8d780000; 15 | RAM[14] <= 32'had6c0000; 16 | RAM[15] <= 32'hadb80000; 17 | RAM[16] <= 32'h1560fff1; 18 | RAM[17] <= 32'h00000000; 19 | RAM[18] <= 32'h00000000; 20 | RAM[19] <= 32'h00000000; 21 | RAM[20] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bisection/bisection.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h2002002c; 2 | RAM[1] <= 32'h20040000; 3 | RAM[2] <= 32'h2005001f; 4 | RAM[3] <= 32'h20100080; 5 | RAM[4] <= 32'h00853020; 6 | RAM[5] <= 32'h00063043; 7 | RAM[6] <= 32'hae060000; 8 | RAM[7] <= 32'h22100004; 9 | RAM[8] <= 32'h00063880; 10 | RAM[9] <= 32'h8ce30000; 11 | RAM[10] <= 32'h0062882a; 12 | RAM[11] <= 32'h14110003; 13 | RAM[12] <= 32'h10620004; 14 | RAM[13] <= 32'h00c02820; 15 | RAM[14] <= 32'h08000004; 16 | RAM[15] <= 32'h00c02020; 17 | RAM[16] <= 32'h08000004; 18 | RAM[17] <= 32'h00000000; 19 | RAM[18] <= 32'h00000000; 20 | RAM[19] <= 32'h00000000; 21 | RAM[20] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bubble sort/bubble sort.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h00004020; 2 | RAM[1] <= 32'h200b0080; 3 | RAM[2] <= 32'h0008e820; 4 | RAM[3] <= 32'h8fac0000; 5 | RAM[4] <= 32'h001d6820; 6 | RAM[5] <= 32'h8fae0000; 7 | RAM[6] <= 32'h01cc782a; 8 | RAM[7] <= 32'h140f0002; 9 | RAM[8] <= 32'h000e6020; 10 | RAM[9] <= 32'h03a06820; 11 | RAM[10] <= 32'h23bd0004; 12 | RAM[11] <= 32'h157dfff9; 13 | RAM[12] <= 32'h216bfffc; 14 | RAM[13] <= 32'h8d780000; 15 | RAM[14] <= 32'had6c0000; 16 | RAM[15] <= 32'hadb80000; 17 | RAM[16] <= 32'h1560fff1; 18 | RAM[17] <= 32'h00000000; 19 | RAM[18] <= 32'h00000000; 20 | RAM[19] <= 32'h00000000; 21 | RAM[20] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-2/benchtest/ad hoc/ad hoc.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20020005; 2 | RAM[1] <= 32'h2003000c; 3 | RAM[2] <= 32'h2067fff7; 4 | RAM[3] <= 32'h00e22025; 5 | RAM[4] <= 32'h00642824; 6 | RAM[5] <= 32'h00a42820; 7 | RAM[6] <= 32'h10a7000a; 8 | RAM[7] <= 32'h0064202a; 9 | RAM[8] <= 32'h10800001; 10 | RAM[9] <= 32'h20050000; 11 | RAM[10] <= 32'h00e2202a; 12 | RAM[11] <= 32'h00853820; 13 | RAM[12] <= 32'h00e23822; 14 | RAM[13] <= 32'hac670044; 15 | RAM[14] <= 32'h8c020050; 16 | RAM[15] <= 32'h08000011; 17 | RAM[16] <= 32'h20020001; 18 | RAM[17] <= 32'hac020054; 19 | RAM[18] <= 32'h00000000; 20 | RAM[19] <= 32'h00000000; 21 | RAM[20] <= 32'h00000000; 22 | RAM[21] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/ad hoc/ad hoc.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20020005; 2 | RAM[1] <= 32'h2003000c; 3 | RAM[2] <= 32'h2067fff7; 4 | RAM[3] <= 32'h00e22025; 5 | RAM[4] <= 32'h00642824; 6 | RAM[5] <= 32'h00a42820; 7 | RAM[6] <= 32'h10a7000a; 8 | RAM[7] <= 32'h0064202a; 9 | RAM[8] <= 32'h10800001; 10 | RAM[9] <= 32'h20050000; 11 | RAM[10] <= 32'h00e2202a; 12 | RAM[11] <= 32'h00853820; 13 | RAM[12] <= 32'h00e23822; 14 | RAM[13] <= 32'hac670044; 15 | RAM[14] <= 32'h8c020050; 16 | RAM[15] <= 32'h08000011; 17 | RAM[16] <= 32'h20020001; 18 | RAM[17] <= 32'hac020054; 19 | RAM[18] <= 32'h00000000; 20 | RAM[19] <= 32'h00000000; 21 | RAM[20] <= 32'h00000000; 22 | RAM[21] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-3(I)/src/line.v: -------------------------------------------------------------------------------- 1 | `include "cache.vh" 2 | /** 3 | * w_en: write enable 4 | */ 5 | module line #( 6 | parameter TAG_WIDTH = `CACHE_T, 7 | OFFSET_WIDTH = `CACHE_B 8 | )( 9 | input clk, reset, 10 | input [OFFSET_WIDTH - 3:0] offset, 11 | input w_en, set_valid, set_dirty, 12 | input [TAG_WIDTH - 1:0] set_tag, 13 | input [31:0] write_data, 14 | output reg valid, 15 | output dirty, 16 | output reg [TAG_WIDTH - 1:0] tag, 17 | output [31:0] read_data 18 | ); 19 | 20 | /** 21 | * TODO: Your code here 22 | */ 23 | 24 | endmodule 25 | -------------------------------------------------------------------------------- /assignment-1/benchtest/quick multiply/quick multiply.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $t0, $0, 99 | 20080063 2 | 0x4 : addi $t1, $0, 37 | 20090025 3 | 0x8 : addi $s0, $0, 0 | 20100000 4 | 0xc : addi $a0, $0, 0 | 20040000 5 | 0x10 : while: | 6 | 0x10 : beq $t1, $0, done | 10090008 7 | 0x14 : andi $t2, $t1, 1 | 312a0001 8 | 0x18 : beq $t2, $0, target | 100a0003 9 | 0x1c : add $s0, $s0, $t0 | 02088020 10 | 0x20 : sw $s0, 0($a0) | ac900000 11 | 0x24 : addi $a0, $a0, 4 | 20840004 12 | 0x28 : target: | 13 | 0x28 : sll $t0, $t0, 1 | 00084040 14 | 0x2c : srl $t1, $t1, 1 | 00094842 15 | 0x30 : j while | 08000004 16 | 0x34 : done: | 17 | 0x34 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-1/benchtest/factorial/factorial.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h201d0080; 2 | RAM[1] <= 32'h20040005; 3 | RAM[2] <= 32'h20050000; 4 | RAM[3] <= 32'h0c000007; 5 | RAM[4] <= 32'haca20000; 6 | RAM[5] <= 32'h00021040; 7 | RAM[6] <= 32'h00000000; 8 | RAM[7] <= 32'h23bdfff8; 9 | RAM[8] <= 32'hafa40004; 10 | RAM[9] <= 32'hafbf0000; 11 | RAM[10] <= 32'h20080002; 12 | RAM[11] <= 32'h0088402a; 13 | RAM[12] <= 32'h10080003; 14 | RAM[13] <= 32'h20020001; 15 | RAM[14] <= 32'h23bd0008; 16 | RAM[15] <= 32'h03e00008; 17 | RAM[16] <= 32'h2084ffff; 18 | RAM[17] <= 32'h0c000007; 19 | RAM[18] <= 32'h8fbf0000; 20 | RAM[19] <= 32'h8fa40004; 21 | RAM[20] <= 32'h23bd0008; 22 | RAM[21] <= 32'haca20000; 23 | RAM[22] <= 32'h00821020; 24 | RAM[23] <= 32'h20a50004; 25 | RAM[24] <= 32'h03e00008; -------------------------------------------------------------------------------- /assignment-1/benchtest/gcd/gcd.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $v0,$0,189 | 200200bd 2 | 0x4 : addi $v1,$0,287 | 2003011f 3 | 0x8 : add $a0, $0, $0 | 00002020 4 | 0xc : main: | 5 | 0xc : sw $v0, 0($a0) | ac820000 6 | 0x10 : sw $v1, 4($a0) | ac830004 7 | 0x14 : addi $a0, $a0, 8 | 20840008 8 | 0x18 : beq $v0,$v1,end | 10620007 9 | 0x1c : slt $at,$v0,$v1 | 0043082a 10 | 0x20 : beq $at,$0,run | 10010003 11 | 0x24 : add $at,$v0,$0 | 00400820 12 | 0x28 : add $v0,$v1,$0 | 00601020 13 | 0x2c : add $v1,$at,$0 | 00201820 14 | 0x30 : run: | 15 | 0x30 : sub $v0,$v0,$v1 | 00431022 16 | 0x34 : j main | 08000003 17 | 0x38 : end: | 18 | 0x38 : nop | 00000000 19 | -------------------------------------------------------------------------------- /assignment-2/benchtest/i-type/i-type.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $t8, $0, 1905 | 20180771 2 | 0x4 : addi $t9, $0, -2020 | 2019f81c 3 | 0x8 : slti $s1, $t8, -2020 | 2b11f81c 4 | 0xc : sw $s1, 0($0) | ac110000 5 | 0x10 : slti $s1, $t9, 2020 | 2b3107e4 6 | 0x14 : sw $s1, 4($0) | ac110004 7 | 0x18 : andi $s1, $t9, -1 | 3331ffff 8 | 0x1c : sw $s1, 8($0) | ac110008 9 | 0x20 : andi $s1, $t9, 32767 | 33317fff 10 | 0x24 : sw $s1, 12($0) | ac11000c 11 | 0x28 : ori $s1, $t8, -8 | 3711fff8 12 | 0x2c : sw $s1, 16($0) | ac110010 13 | 0x30 : ori $s1, $t9, 2020 | 373107e4 14 | 0x34 : sw $s1, 20($0) | ac110014 15 | 0x38 : nop | 00000000 16 | 0x3c : nop | 00000000 17 | 0x40 : nop | 00000000 18 | 0x44 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/mutual recursion/mutual recursion.mem: -------------------------------------------------------------------------------- 1 | 20100000 2 | 20080066 3 | ae080000 4 | 20080067 5 | ae080004 6 | 20080066 7 | ae080008 8 | 20080067 9 | ae08000c 10 | 20080061 11 | ae080010 12 | 201d0080 13 | 20040000 14 | 0c000013 15 | 20510000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 23bdfff8 21 | afa40004 22 | afbf0000 23 | 0004c880 24 | 0219c820 25 | 8f280000 26 | 20090061 27 | 15280002 28 | 20820001 29 | 08000023 30 | 20090066 31 | 15280003 32 | 20840001 33 | 0c000027 34 | 08000023 35 | 2002ffff 36 | 8fbf0000 37 | 8fa40004 38 | 23bd0008 39 | 03e00008 40 | 23bdfff8 41 | afa40004 42 | afbf0000 43 | 0004c880 44 | 0219c820 45 | 8f280000 46 | 20090067 47 | 15280003 48 | 20840001 49 | 0c000013 50 | 08000033 51 | 2002ffff 52 | 8fbf0000 53 | 8fa40004 54 | 23bd0008 55 | 03e00008 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/mutual recursion/mutual recursion.mem: -------------------------------------------------------------------------------- 1 | 20100000 2 | 20080066 3 | ae080000 4 | 20080067 5 | ae080004 6 | 20080066 7 | ae080008 8 | 20080067 9 | ae08000c 10 | 20080061 11 | ae080010 12 | 201d0080 13 | 20040000 14 | 0c000013 15 | 20510000 16 | 00000000 17 | 00000000 18 | 00000000 19 | 00000000 20 | 23bdfff8 21 | afa40004 22 | afbf0000 23 | 0004c880 24 | 0219c820 25 | 8f280000 26 | 20090061 27 | 15280002 28 | 20820001 29 | 08000023 30 | 20090066 31 | 15280003 32 | 20840001 33 | 0c000027 34 | 08000023 35 | 2002ffff 36 | 8fbf0000 37 | 8fa40004 38 | 23bd0008 39 | 03e00008 40 | 23bdfff8 41 | afa40004 42 | afbf0000 43 | 0004c880 44 | 0219c820 45 | 8f280000 46 | 20090067 47 | 15280003 48 | 20840001 49 | 0c000013 50 | 08000033 51 | 2002ffff 52 | 8fbf0000 53 | 8fa40004 54 | 23bd0008 55 | 03e00008 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/i-type/i-type.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $t8, $0, 1905 | 20180771 2 | 0x4 : addi $t9, $0, -2020 | 2019f81c 3 | 0x8 : slti $s1, $t8, -2020 | 2b11f81c 4 | 0xc : sw $s1, 0($0) | ac110000 5 | 0x10 : slti $s1, $t9, 2020 | 2b3107e4 6 | 0x14 : sw $s1, 4($0) | ac110004 7 | 0x18 : andi $s1, $t9, -1 | 3331ffff 8 | 0x1c : sw $s1, 8($0) | ac110008 9 | 0x20 : andi $s1, $t9, 32767 | 33317fff 10 | 0x24 : sw $s1, 12($0) | ac11000c 11 | 0x28 : ori $s1, $t8, -8 | 3711fff8 12 | 0x2c : sw $s1, 16($0) | ac110010 13 | 0x30 : ori $s1, $t9, 2020 | 373107e4 14 | 0x34 : sw $s1, 20($0) | ac110014 15 | 0x38 : nop | 00000000 16 | 0x3c : nop | 00000000 17 | 0x40 : nop | 00000000 18 | 0x44 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/factorial/factorial.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h201d0080; 2 | RAM[1] <= 32'h20040005; 3 | RAM[2] <= 32'h20050000; 4 | RAM[3] <= 32'h0c00000a; 5 | RAM[4] <= 32'haca20000; 6 | RAM[5] <= 32'h00021040; 7 | RAM[6] <= 32'h00000000; 8 | RAM[7] <= 32'h00000000; 9 | RAM[8] <= 32'h00000000; 10 | RAM[9] <= 32'h00000000; 11 | RAM[10] <= 32'h23bdfff8; 12 | RAM[11] <= 32'hafa40004; 13 | RAM[12] <= 32'hafbf0000; 14 | RAM[13] <= 32'h20080002; 15 | RAM[14] <= 32'h0088402a; 16 | RAM[15] <= 32'h10080003; 17 | RAM[16] <= 32'h20020001; 18 | RAM[17] <= 32'h23bd0008; 19 | RAM[18] <= 32'h03e00008; 20 | RAM[19] <= 32'h2084ffff; 21 | RAM[20] <= 32'h0c00000a; 22 | RAM[21] <= 32'h8fbf0000; 23 | RAM[22] <= 32'h8fa40004; 24 | RAM[23] <= 32'h23bd0008; 25 | RAM[24] <= 32'haca20000; 26 | RAM[25] <= 32'h00821020; 27 | RAM[26] <= 32'h20a50004; 28 | RAM[27] <= 32'h03e00008; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/factorial/factorial.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h201d0080; 2 | RAM[1] <= 32'h20040005; 3 | RAM[2] <= 32'h20050000; 4 | RAM[3] <= 32'h0c00000a; 5 | RAM[4] <= 32'haca20000; 6 | RAM[5] <= 32'h00021040; 7 | RAM[6] <= 32'h00000000; 8 | RAM[7] <= 32'h00000000; 9 | RAM[8] <= 32'h00000000; 10 | RAM[9] <= 32'h00000000; 11 | RAM[10] <= 32'h23bdfff8; 12 | RAM[11] <= 32'hafa40004; 13 | RAM[12] <= 32'hafbf0000; 14 | RAM[13] <= 32'h20080002; 15 | RAM[14] <= 32'h0088402a; 16 | RAM[15] <= 32'h10080003; 17 | RAM[16] <= 32'h20020001; 18 | RAM[17] <= 32'h23bd0008; 19 | RAM[18] <= 32'h03e00008; 20 | RAM[19] <= 32'h2084ffff; 21 | RAM[20] <= 32'h0c00000a; 22 | RAM[21] <= 32'h8fbf0000; 23 | RAM[22] <= 32'h8fa40004; 24 | RAM[23] <= 32'h23bd0008; 25 | RAM[24] <= 32'haca20000; 26 | RAM[25] <= 32'h00821020; 27 | RAM[26] <= 32'h20a50004; 28 | RAM[27] <= 32'h03e00008; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/random write/random write.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $t0, $0, 17 | 20080011 2 | 0x4 : addi $t1, $0, 32 | 20090020 3 | 0x8 : addi $t3, $0, 16 | 200b0010 4 | 0xc : addi $s0, $0, 0 | 20100000 5 | 0x10 : For: | 6 | 0x10 : addi $t2, $0, 0 | 200a0000 7 | 0x14 : for: | 8 | 0x14 : add $s0, $s0, $t0 | 02088020 9 | 0x18 : andi $t4, $s0, 127 | 320c007f 10 | 0x1c : sll $t4, $t4, 2 | 000c6080 11 | 0x20 : sw $t0, 0($t4) | ad880000 12 | 0x24 : addi $t2, $t2, 1 | 214a0001 13 | 0x28 : bne $t2, $t3, for | 156afffa 14 | 0x2c : addi $t0, $t0, 1 | 21080001 15 | 0x30 : bne $t0, $t1, For | 1528fff7 16 | 0x34 : nop | 00000000 17 | 0x38 : nop | 00000000 18 | 0x3c : nop | 00000000 19 | 0x40 : nop | 20 | -------------------------------------------------------------------------------- /assignment-2/benchtest/quick multiply/quick multiply.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $t0, $0, 99 | 20080063 2 | 0x4 : addi $t1, $0, 37 | 20090025 3 | 0x8 : addi $s0, $0, 0 | 20100000 4 | 0xc : addi $a0, $0, 0 | 20040000 5 | 0x10 : while: | 6 | 0x10 : beq $t1, $0, done | 10090008 7 | 0x14 : andi $t2, $t1, 1 | 312a0001 8 | 0x18 : beq $t2, $0, target | 100a0003 9 | 0x1c : add $s0, $s0, $t0 | 02088020 10 | 0x20 : sw $s0, 0($a0) | ac900000 11 | 0x24 : addi $a0, $a0, 4 | 20840004 12 | 0x28 : target: | 13 | 0x28 : sll $t0, $t0, 1 | 00084040 14 | 0x2c : srl $t1, $t1, 1 | 00094842 15 | 0x30 : j while | 08000004 16 | 0x34 : done: | 17 | 0x34 : nop | 00000000 18 | 0x38 : nop | 00000000 19 | 0x3c : nop | 00000000 20 | 0x40 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/quick multiply/quick multiply.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $t0, $0, 99 | 20080063 2 | 0x4 : addi $t1, $0, 37 | 20090025 3 | 0x8 : addi $s0, $0, 0 | 20100000 4 | 0xc : addi $a0, $0, 0 | 20040000 5 | 0x10 : while: | 6 | 0x10 : beq $t1, $0, done | 10090008 7 | 0x14 : andi $t2, $t1, 1 | 312a0001 8 | 0x18 : beq $t2, $0, target | 100a0003 9 | 0x1c : add $s0, $s0, $t0 | 02088020 10 | 0x20 : sw $s0, 0($a0) | ac900000 11 | 0x24 : addi $a0, $a0, 4 | 20840004 12 | 0x28 : target: | 13 | 0x28 : sll $t0, $t0, 1 | 00084040 14 | 0x2c : srl $t1, $t1, 1 | 00094842 15 | 0x30 : j while | 08000004 16 | 0x34 : done: | 17 | 0x34 : nop | 00000000 18 | 0x38 : nop | 00000000 19 | 0x3c : nop | 00000000 20 | 0x40 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/src/cache_controller.v: -------------------------------------------------------------------------------- 1 | /** 2 | * en : en in cache module 3 | * cw_en : cache writing enable signal, from w_en in cache module 4 | * hit, dirty : from set module 5 | * 6 | * w_en : writing enable signal to cache line 7 | * mw_en : writing enable signal to memory , controls whether to write to memory 8 | * set_valid : control signal for cache line 9 | * set_dirty : control signal for cache line 10 | * offset_sel : control signal for cache line and this may be used in other places 11 | */ 12 | module cache_controller #( 13 | parameter OFFSET_WIDTH = `CACHE_B 14 | )( 15 | input clk, reset, en, cw_en, hit, dirty, // mready, 16 | output w_en, set_valid, set_dirty, mw_en, 17 | output [OFFSET_WIDTH - 3:0] block_offset, 18 | output strategy_en, 19 | output reg offset_sel 20 | ); 21 | 22 | /** 23 | * TODO: Your code here 24 | */ 25 | 26 | endmodule 27 | -------------------------------------------------------------------------------- /assignment-2/benchtest/gcd/gcd.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $v0,$0,189 | 200200bd 2 | 0x4 : addi $v1,$0,287 | 2003011f 3 | 0x8 : add $a0, $0, $0 | 00002020 4 | 0xc : main: | 5 | 0xc : sw $v0, 0($a0) | ac820000 6 | 0x10 : sw $v1, 4($a0) | ac830004 7 | 0x14 : addi $a0, $a0, 8 | 20840008 8 | 0x18 : beq $v0,$v1,end | 10620007 9 | 0x1c : slt $at,$v0,$v1 | 0043082a 10 | 0x20 : beq $at,$0,run | 10010003 11 | 0x24 : add $at,$v0,$0 | 00400820 12 | 0x28 : add $v0,$v1,$0 | 00601020 13 | 0x2c : add $v1,$at,$0 | 00201820 14 | 0x30 : run: | 15 | 0x30 : sub $v0,$v0,$v1 | 00431022 16 | 0x34 : j main | 08000003 17 | 0x38 : end: | 18 | 0x38 : nop | 00000000 19 | 0x3c : nop | 00000000 20 | 0x40 : nop | 00000000 21 | 0x44 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/testjr/testjr.mem: -------------------------------------------------------------------------------- 1 | 201d0040 2 | 2008000a 3 | 20090064 4 | 2004001c 5 | 20040024 6 | 00000000 7 | 00800008 8 | afa80000 9 | 0800000a 10 | afa90000 11 | 23bdfff8 12 | 20040038 13 | 20040040 14 | 00800008 15 | afa80000 16 | 08000011 17 | afa90000 18 | 23bdfff8 19 | 20040064 20 | ac040000 21 | 2004006c 22 | ac040008 23 | 8c040000 24 | 8c040008 25 | 00800008 26 | afa80000 27 | 0800001c 28 | afa90000 29 | 23bdfff8 30 | 20040090 31 | ac040010 32 | 20040088 33 | 8c040010 34 | 00800008 35 | afa80000 36 | 08000025 37 | afa90000 38 | 20080006 39 | ac080000 40 | 0000e820 41 | 01204824 42 | 21290006 43 | 8fa80000 44 | 1128fffd 45 | ac090004 46 | 200800dc 47 | ac080000 48 | 200800f0 49 | ac080004 50 | 03a0e824 51 | 01004024 52 | ac000018 53 | 8fa80000 54 | 01000008 55 | afa80050 56 | 8fa80004 57 | 2108fffc 58 | 01000008 59 | afa80054 60 | ac08000c 61 | 00000000 62 | 00000000 63 | 00000000 64 | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/gcd/gcd.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $v0,$0,189 | 200200bd 2 | 0x4 : addi $v1,$0,287 | 2003011f 3 | 0x8 : add $a0, $0, $0 | 00002020 4 | 0xc : main: | 5 | 0xc : sw $v0, 0($a0) | ac820000 6 | 0x10 : sw $v1, 4($a0) | ac830004 7 | 0x14 : addi $a0, $a0, 8 | 20840008 8 | 0x18 : beq $v0,$v1,end | 10620007 9 | 0x1c : slt $at,$v0,$v1 | 0043082a 10 | 0x20 : beq $at,$0,run | 10010003 11 | 0x24 : add $at,$v0,$0 | 00400820 12 | 0x28 : add $v0,$v1,$0 | 00601020 13 | 0x2c : add $v1,$at,$0 | 00201820 14 | 0x30 : run: | 15 | 0x30 : sub $v0,$v0,$v1 | 00431022 16 | 0x34 : j main | 08000003 17 | 0x38 : end: | 18 | 0x38 : nop | 00000000 19 | 0x3c : nop | 00000000 20 | 0x40 : nop | 00000000 21 | 0x44 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/testjr/testjr.mem: -------------------------------------------------------------------------------- 1 | 201d0040 2 | 2008000a 3 | 20090064 4 | 2004001c 5 | 20040024 6 | 00000000 7 | 00800008 8 | afa80000 9 | 0800000a 10 | afa90000 11 | 23bdfff8 12 | 20040038 13 | 20040040 14 | 00800008 15 | afa80000 16 | 08000011 17 | afa90000 18 | 23bdfff8 19 | 20040064 20 | ac040000 21 | 2004006c 22 | ac040008 23 | 8c040000 24 | 8c040008 25 | 00800008 26 | afa80000 27 | 0800001c 28 | afa90000 29 | 23bdfff8 30 | 20040090 31 | ac040010 32 | 20040088 33 | 8c040010 34 | 00800008 35 | afa80000 36 | 08000025 37 | afa90000 38 | 20080006 39 | ac080000 40 | 0000e820 41 | 01204824 42 | 21290006 43 | 8fa80000 44 | 1128fffd 45 | ac090004 46 | 200800dc 47 | ac080000 48 | 200800f0 49 | ac080004 50 | 03a0e824 51 | 01004024 52 | ac000018 53 | 8fa80000 54 | 01000008 55 | afa80050 56 | 8fa80004 57 | 2108fffc 58 | 01000008 59 | afa80054 60 | ac08000c 61 | 00000000 62 | 00000000 63 | 00000000 64 | 00000000 -------------------------------------------------------------------------------- /assignment-1/benchtest/bisection/bisection.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $v0, $0, 44 | 2002002c 2 | 0x4 : addi $a0, $0, 0 | 20040000 3 | 0x8 : addi $a1, $0, 31 | 2005001f 4 | 0xc : addi $s0, $0, 128 | 20100080 5 | 0x10 : mid: | 6 | 0x10 : add $a2, $a0, $a1 | 00853020 7 | 0x14 : sra $a2, $a2, 1 | 00063043 8 | 0x18 : sw $a2, 0($s0) | ae060000 9 | 0x1c : addi $s0, $s0, 4 | 22100004 10 | 0x20 : sll $a3, $a2, 2 | 00063880 11 | 0x24 : lw $v1, 0($a3) | 8ce30000 12 | 0x28 : slt $s1, $v1, $v0 | 0062882a 13 | 0x2c : bne $s1, $0, less | 14110003 14 | 0x30 : beq $v0, $v1, exit | 10620004 15 | 0x34 : add $a1, $a2, $0 | 00c02820 16 | 0x38 : j mid | 08000004 17 | 0x3c : less: | 18 | 0x3c : add $a0, $a2, $0 | 00c02020 19 | 0x40 : j mid | 08000004 20 | 0x44 : exit: | 21 | 0x44 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-1/benchtest/bubble sort/bubble sort.out: -------------------------------------------------------------------------------- 1 | 0x0 : add $t0, $0, $0 | 00004020 2 | 0x4 : addi $t3, $0, 128 | 200b0080 3 | 0x8 : For: | 4 | 0x8 : add $sp, $0, $t0 | 0008e820 5 | 0xc : lw $t4, 0($sp) | 8fac0000 6 | 0x10 : add $t5, $0, $sp | 001d6820 7 | 0x14 : for: | 8 | 0x14 : lw $t6, 0($sp) | 8fae0000 9 | 0x18 : slt $t7, $t6, $t4 | 01cc782a 10 | 0x1c : bne $t7, $0, ret | 140f0002 11 | 0x20 : add $t4, $0, $t6 | 000e6020 12 | 0x24 : add $t5, $sp, $0 | 03a06820 13 | 0x28 : ret: | 14 | 0x28 : addi $sp, $sp, 4 | 23bd0004 15 | 0x2c : bne $sp, $t3, for | 157dfff9 16 | 0x30 : addi $t3, $t3, -4 | 216bfffc 17 | 0x34 : lw $t8, 0($t3) | 8d780000 18 | 0x38 : sw $t4, 0($t3) | ad6c0000 19 | 0x3c : sw $t8, 0($t5) | adb80000 20 | 0x40 : bne $0, $t3, For | 1560fff1 21 | 0x44 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-1/benchtest/gcd/gcd.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x000000bd 2 | [0x00000004]=0x0000011f 3 | [0x00000008]=0x00000062 4 | [0x0000000c]=0x000000bd 5 | [0x00000010]=0x0000005b 6 | [0x00000014]=0x00000062 7 | [0x00000018]=0x00000007 8 | [0x0000001c]=0x0000005b 9 | [0x00000020]=0x00000054 10 | [0x00000024]=0x00000007 11 | [0x00000028]=0x0000004d 12 | [0x0000002c]=0x00000007 13 | [0x00000030]=0x00000046 14 | [0x00000034]=0x00000007 15 | [0x00000038]=0x0000003f 16 | [0x0000003c]=0x00000007 17 | [0x00000040]=0x00000038 18 | [0x00000044]=0x00000007 19 | [0x00000048]=0x00000031 20 | [0x0000004c]=0x00000007 21 | [0x00000050]=0x0000002a 22 | [0x00000054]=0x00000007 23 | [0x00000058]=0x00000023 24 | [0x0000005c]=0x00000007 25 | [0x00000060]=0x0000001c 26 | [0x00000064]=0x00000007 27 | [0x00000068]=0x00000015 28 | [0x0000006c]=0x00000007 29 | [0x00000070]=0x0000000e 30 | [0x00000074]=0x00000007 31 | [0x00000078]=0x00000007 32 | [0x0000007c]=0x00000007 -------------------------------------------------------------------------------- /assignment-2/benchtest/gcd/gcd.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x000000bd 2 | [0x00000004]=0x0000011f 3 | [0x00000008]=0x00000062 4 | [0x0000000c]=0x000000bd 5 | [0x00000010]=0x0000005b 6 | [0x00000014]=0x00000062 7 | [0x00000018]=0x00000007 8 | [0x0000001c]=0x0000005b 9 | [0x00000020]=0x00000054 10 | [0x00000024]=0x00000007 11 | [0x00000028]=0x0000004d 12 | [0x0000002c]=0x00000007 13 | [0x00000030]=0x00000046 14 | [0x00000034]=0x00000007 15 | [0x00000038]=0x0000003f 16 | [0x0000003c]=0x00000007 17 | [0x00000040]=0x00000038 18 | [0x00000044]=0x00000007 19 | [0x00000048]=0x00000031 20 | [0x0000004c]=0x00000007 21 | [0x00000050]=0x0000002a 22 | [0x00000054]=0x00000007 23 | [0x00000058]=0x00000023 24 | [0x0000005c]=0x00000007 25 | [0x00000060]=0x0000001c 26 | [0x00000064]=0x00000007 27 | [0x00000068]=0x00000015 28 | [0x0000006c]=0x00000007 29 | [0x00000070]=0x0000000e 30 | [0x00000074]=0x00000007 31 | [0x00000078]=0x00000007 32 | [0x0000007c]=0x00000007 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/gcd/gcd.run: -------------------------------------------------------------------------------- 1 | [0x00000000]=0x000000bd 2 | [0x00000004]=0x0000011f 3 | [0x00000008]=0x00000062 4 | [0x0000000c]=0x000000bd 5 | [0x00000010]=0x0000005b 6 | [0x00000014]=0x00000062 7 | [0x00000018]=0x00000007 8 | [0x0000001c]=0x0000005b 9 | [0x00000020]=0x00000054 10 | [0x00000024]=0x00000007 11 | [0x00000028]=0x0000004d 12 | [0x0000002c]=0x00000007 13 | [0x00000030]=0x00000046 14 | [0x00000034]=0x00000007 15 | [0x00000038]=0x0000003f 16 | [0x0000003c]=0x00000007 17 | [0x00000040]=0x00000038 18 | [0x00000044]=0x00000007 19 | [0x00000048]=0x00000031 20 | [0x0000004c]=0x00000007 21 | [0x00000050]=0x0000002a 22 | [0x00000054]=0x00000007 23 | [0x00000058]=0x00000023 24 | [0x0000005c]=0x00000007 25 | [0x00000060]=0x0000001c 26 | [0x00000064]=0x00000007 27 | [0x00000068]=0x00000015 28 | [0x0000006c]=0x00000007 29 | [0x00000070]=0x0000000e 30 | [0x00000074]=0x00000007 31 | [0x00000078]=0x00000007 32 | [0x0000007c]=0x00000007 -------------------------------------------------------------------------------- /assignment-1/benchtest/ad hoc/ad hoc.out: -------------------------------------------------------------------------------- 1 | 0x0 : main: | 2 | 0x0 : addi $v0, $0, 5 | 20020005 3 | 0x4 : addi $v1, $0, 12 | 2003000c 4 | 0x8 : addi $a3, $v1, -9 | 2067fff7 5 | 0xc : or $a0, $a3, $v0 | 00e22025 6 | 0x10 : and $a1, $v1, $a0 | 00642824 7 | 0x14 : add $a1, $a1, $a0 | 00a42820 8 | 0x18 : beq $a3, $a1, end | 10a7000a 9 | 0x1c : slt $a0, $v1, $a0 | 0064202a 10 | 0x20 : beq $0, $a0, around | 10800001 11 | 0x24 : addi $a1, $0, 0 | 20050000 12 | 0x28 : around: | 13 | 0x28 : slt $a0, $a3, $v0 | 00e2202a 14 | 0x2c : add $a3, $a0, $a1 | 00853820 15 | 0x30 : sub $a3, $a3, $v0 | 00e23822 16 | 0x34 : sw $a3, 68($v1) | ac670044 17 | 0x38 : lw $v0, 80($0) | 8c020050 18 | 0x3c : j end | 08000011 19 | 0x40 : addi $v0, $0, 1 | 20020001 20 | 0x44 : end: | 21 | 0x44 : sw $v0, 84($0) | ac020054 22 | 0x48 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/bisection/bisection.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $v0, $0, 44 | 2002002c 2 | 0x4 : addi $a0, $0, 0 | 20040000 3 | 0x8 : addi $a1, $0, 31 | 2005001f 4 | 0xc : addi $s0, $0, 128 | 20100080 5 | 0x10 : mid: | 6 | 0x10 : add $a2, $a0, $a1 | 00853020 7 | 0x14 : sra $a2, $a2, 1 | 00063043 8 | 0x18 : sw $a2, 0($s0) | ae060000 9 | 0x1c : addi $s0, $s0, 4 | 22100004 10 | 0x20 : sll $a3, $a2, 2 | 00063880 11 | 0x24 : lw $v1, 0($a3) | 8ce30000 12 | 0x28 : slt $s1, $v1, $v0 | 0062882a 13 | 0x2c : bne $s1, $0, less | 14110003 14 | 0x30 : beq $v0, $v1, exit | 10620004 15 | 0x34 : add $a1, $a2, $0 | 00c02820 16 | 0x38 : j mid | 08000004 17 | 0x3c : less: | 18 | 0x3c : add $a0, $a2, $0 | 00c02020 19 | 0x40 : j mid | 08000004 20 | 0x44 : exit: | 21 | 0x44 : nop | 00000000 22 | 0x48 : nop | 00000000 23 | 0x4c : nop | 00000000 24 | 0x50 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/bubble sort/bubble sort.out: -------------------------------------------------------------------------------- 1 | 0x0 : add $t0, $0, $0 | 00004020 2 | 0x4 : addi $t3, $0, 128 | 200b0080 3 | 0x8 : For: | 4 | 0x8 : add $sp, $0, $t0 | 0008e820 5 | 0xc : lw $t4, 0($sp) | 8fac0000 6 | 0x10 : add $t5, $0, $sp | 001d6820 7 | 0x14 : for: | 8 | 0x14 : lw $t6, 0($sp) | 8fae0000 9 | 0x18 : slt $t7, $t6, $t4 | 01cc782a 10 | 0x1c : bne $t7, $0, ret | 140f0002 11 | 0x20 : add $t4, $0, $t6 | 000e6020 12 | 0x24 : add $t5, $sp, $0 | 03a06820 13 | 0x28 : ret: | 14 | 0x28 : addi $sp, $sp, 4 | 23bd0004 15 | 0x2c : bne $sp, $t3, for | 157dfff9 16 | 0x30 : addi $t3, $t3, -4 | 216bfffc 17 | 0x34 : lw $t8, 0($t3) | 8d780000 18 | 0x38 : sw $t4, 0($t3) | ad6c0000 19 | 0x3c : sw $t8, 0($t5) | adb80000 20 | 0x40 : bne $0, $t3, For | 1560fff1 21 | 0x44 : nop | 00000000 22 | 0x48 : nop | 00000000 23 | 0x4c : nop | 00000000 24 | 0x50 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bisection/bisection.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $v0, $0, 44 | 2002002c 2 | 0x4 : addi $a0, $0, 0 | 20040000 3 | 0x8 : addi $a1, $0, 31 | 2005001f 4 | 0xc : addi $s0, $0, 128 | 20100080 5 | 0x10 : mid: | 6 | 0x10 : add $a2, $a0, $a1 | 00853020 7 | 0x14 : sra $a2, $a2, 1 | 00063043 8 | 0x18 : sw $a2, 0($s0) | ae060000 9 | 0x1c : addi $s0, $s0, 4 | 22100004 10 | 0x20 : sll $a3, $a2, 2 | 00063880 11 | 0x24 : lw $v1, 0($a3) | 8ce30000 12 | 0x28 : slt $s1, $v1, $v0 | 0062882a 13 | 0x2c : bne $s1, $0, less | 14110003 14 | 0x30 : beq $v0, $v1, exit | 10620004 15 | 0x34 : add $a1, $a2, $0 | 00c02820 16 | 0x38 : j mid | 08000004 17 | 0x3c : less: | 18 | 0x3c : add $a0, $a2, $0 | 00c02020 19 | 0x40 : j mid | 08000004 20 | 0x44 : exit: | 21 | 0x44 : nop | 00000000 22 | 0x48 : nop | 00000000 23 | 0x4c : nop | 00000000 24 | 0x50 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bubble sort/bubble sort.out: -------------------------------------------------------------------------------- 1 | 0x0 : add $t0, $0, $0 | 00004020 2 | 0x4 : addi $t3, $0, 128 | 200b0080 3 | 0x8 : For: | 4 | 0x8 : add $sp, $0, $t0 | 0008e820 5 | 0xc : lw $t4, 0($sp) | 8fac0000 6 | 0x10 : add $t5, $0, $sp | 001d6820 7 | 0x14 : for: | 8 | 0x14 : lw $t6, 0($sp) | 8fae0000 9 | 0x18 : slt $t7, $t6, $t4 | 01cc782a 10 | 0x1c : bne $t7, $0, ret | 140f0002 11 | 0x20 : add $t4, $0, $t6 | 000e6020 12 | 0x24 : add $t5, $sp, $0 | 03a06820 13 | 0x28 : ret: | 14 | 0x28 : addi $sp, $sp, 4 | 23bd0004 15 | 0x2c : bne $sp, $t3, for | 157dfff9 16 | 0x30 : addi $t3, $t3, -4 | 216bfffc 17 | 0x34 : lw $t8, 0($t3) | 8d780000 18 | 0x38 : sw $t4, 0($t3) | ad6c0000 19 | 0x3c : sw $t8, 0($t5) | adb80000 20 | 0x40 : bne $0, $t3, For | 1560fff1 21 | 0x44 : nop | 00000000 22 | 0x48 : nop | 00000000 23 | 0x4c : nop | 00000000 24 | 0x50 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-2/benchtest/ad hoc/ad hoc.out: -------------------------------------------------------------------------------- 1 | 0x0 : main: | 2 | 0x0 : addi $v0, $0, 5 | 20020005 3 | 0x4 : addi $v1, $0, 12 | 2003000c 4 | 0x8 : addi $a3, $v1, -9 | 2067fff7 5 | 0xc : or $a0, $a3, $v0 | 00e22025 6 | 0x10 : and $a1, $v1, $a0 | 00642824 7 | 0x14 : add $a1, $a1, $a0 | 00a42820 8 | 0x18 : beq $a3, $a1, end | 10a7000a 9 | 0x1c : slt $a0, $v1, $a0 | 0064202a 10 | 0x20 : beq $0, $a0, around | 10800001 11 | 0x24 : addi $a1, $0, 0 | 20050000 12 | 0x28 : around: | 13 | 0x28 : slt $a0, $a3, $v0 | 00e2202a 14 | 0x2c : add $a3, $a0, $a1 | 00853820 15 | 0x30 : sub $a3, $a3, $v0 | 00e23822 16 | 0x34 : sw $a3, 68($v1) | ac670044 17 | 0x38 : lw $v0, 80($0) | 8c020050 18 | 0x3c : j end | 08000011 19 | 0x40 : addi $v0, $0, 1 | 20020001 20 | 0x44 : end: | 21 | 0x44 : sw $v0, 84($0) | ac020054 22 | 0x48 : nop | 00000000 23 | 0x4c : nop | 00000000 24 | 0x50 : nop | 00000000 25 | 0x54 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/ad hoc/ad hoc.out: -------------------------------------------------------------------------------- 1 | 0x0 : main: | 2 | 0x0 : addi $v0, $0, 5 | 20020005 3 | 0x4 : addi $v1, $0, 12 | 2003000c 4 | 0x8 : addi $a3, $v1, -9 | 2067fff7 5 | 0xc : or $a0, $a3, $v0 | 00e22025 6 | 0x10 : and $a1, $v1, $a0 | 00642824 7 | 0x14 : add $a1, $a1, $a0 | 00a42820 8 | 0x18 : beq $a3, $a1, end | 10a7000a 9 | 0x1c : slt $a0, $v1, $a0 | 0064202a 10 | 0x20 : beq $0, $a0, around | 10800001 11 | 0x24 : addi $a1, $0, 0 | 20050000 12 | 0x28 : around: | 13 | 0x28 : slt $a0, $a3, $v0 | 00e2202a 14 | 0x2c : add $a3, $a0, $a1 | 00853820 15 | 0x30 : sub $a3, $a3, $v0 | 00e23822 16 | 0x34 : sw $a3, 68($v1) | ac670044 17 | 0x38 : lw $v0, 80($0) | 8c020050 18 | 0x3c : j end | 08000011 19 | 0x40 : addi $v0, $0, 1 | 20020001 20 | 0x44 : end: | 21 | 0x44 : sw $v0, 84($0) | ac020054 22 | 0x48 : nop | 00000000 23 | 0x4c : nop | 00000000 24 | 0x50 : nop | 00000000 25 | 0x54 : nop | 00000000 -------------------------------------------------------------------------------- /assignment-3(I)/src/set.v: -------------------------------------------------------------------------------- 1 | `include "cache.vh" 2 | /** 3 | * ctls : control signals from cache_controller 4 | * addr : cache read/write address from processor 5 | * write_data : cache write data from processor 6 | * mread_data : data read from memory 7 | * 8 | * hit : whether cache set hits 9 | * dirty : from the cache line selected by addr (cache line's tag is equal to addr's tag) 10 | */ 11 | module set #( 12 | parameter TAG_WIDTH = `CACHE_T, 13 | OFFSET_WIDTH = `CACHE_B, 14 | LINES = `CACHE_E 15 | )( 16 | input clk, reset, 17 | input [4 + OFFSET_WIDTH-2:0] ctls, 18 | input [31:0] addr, write_data, mread_data, 19 | output hit, dirty, 20 | output [31:0] read_data 21 | ); 22 | 23 | wire w_en, set_valid, set_dirty, init, offsetSW; 24 | wire [OFFSET_WIDTH - 3:0] offset; 25 | 26 | // control signals will be assigned to the target line instance. 27 | assign {w_en, set_valid, set_dirty, offset, strategy_en, offset_sel} = ctls; 28 | 29 | /** 30 | * TODO: Your code here 31 | */ 32 | 33 | endmodule 34 | -------------------------------------------------------------------------------- /assignment-2/check.py: -------------------------------------------------------------------------------- 1 | import zipfile, sys, re, os 2 | 3 | pattern = re.compile(r'(^[0-9]*)') 4 | 5 | def check(zfile): 6 | zFile = zipfile.ZipFile(zfile, "r") 7 | stuId = pattern.match(zfile).group(0) 8 | print(stuId) 9 | cwd = os.getcwd() 10 | for zfile in zFile.namelist(): 11 | zFile.extract(zfile, cwd) 12 | zFile.close() 13 | 14 | if os.path.isdir(stuId): 15 | cwd = os.path.join(cwd, stuId) 16 | cwd = os.path.join(cwd, "Pipeline") 17 | if os.path.isdir(cwd): 18 | makefile = os.path.join(cwd, "makefile") 19 | benchtest = os.path.join(cwd, "benchtest") 20 | if os.path.isfile(makefile) == False: 21 | print("添加 makefile") 22 | elif os.path.isdir(benchtest) == False: 23 | print("添加 benchtest/") 24 | else: 25 | print("应该没啥问题了") 26 | else: 27 | print("项目名为 Pipeline") 28 | else: 29 | print("解压缩文件中需要包一层 %s/ 文件夹" %(stuId)) 30 | 31 | if __name__ == '__main__': 32 | for zfile in os.listdir(os.getcwd()): 33 | if zfile.find('.zip') != -1: 34 | check(zfile) 35 | -------------------------------------------------------------------------------- /assignment-1/benchtest/factorial/factorial.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $sp, $0, 128 | 201d0080 2 | 0x4 : addi $a0, $0, 5 | 20040005 3 | 0x8 : addi $a1, $0, 0 | 20050000 4 | 0xc : jal factorial | 0c000007 5 | 0x10 : sw $v0, 0($a1) | aca20000 6 | 0x14 : sll $v0, $v0, 1 | 00021040 7 | 0x18 : nop | 00000000 8 | 0x1c : | 9 | 0x1c : factorial: | 10 | 0x1c : addi $sp, $sp, -8 | 23bdfff8 11 | 0x20 : sw $a0, 4($sp) | afa40004 12 | 0x24 : sw $ra, 0($sp) | afbf0000 13 | 0x28 : addi $t0, $0, 2 | 20080002 14 | 0x2c : slt $t0, $a0, $t0 | 0088402a 15 | 0x30 : beq $t0, $0 ,else | 10080003 16 | 0x34 : addi $v0, $0, 1 | 20020001 17 | 0x38 : addi $sp, $sp, 8 | 23bd0008 18 | 0x3c : jr $ra | 03e00008 19 | 0x40 : else: | 20 | 0x40 : addi $a0, $a0, -1 | 2084ffff 21 | 0x44 : jal factorial | 0c000007 22 | 0x48 : lw $ra, 0($sp) | 8fbf0000 23 | 0x4c : lw $a0, 4($sp) | 8fa40004 24 | 0x50 : addi $sp, $sp, 8 | 23bd0008 25 | 0x54 : sw $v0, 0($a1) | aca20000 26 | 0x58 : add $v0, $a0, $v0 | 00821020 27 | 0x5c : addi $a1, $a1, 4 | 20a50004 28 | 0x60 : jr $ra | 03e00008 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/README.md: -------------------------------------------------------------------------------- 1 | This file is the same as the one in Pipeline. 2 | 3 | # MIPS Test Bench 4 | 5 | This is a testbench for MIPS CPU. You need to create a vivado project in this directory, thus there will be a `*.xpr` file in this directory. After creating the vivado project, please add `benchtest/cpu_tb.sv` as a simulation source file. 6 | 7 | Please change the value of `PATH_PREFIX` (default is empty `""`) in the 1st line of `cpu_tb.sv` to the absolute path to this project. 8 | 9 | Here are test files (`*.dat`) in `data` filled with machine code and corresponding answer files (`*.ans`) which are used in the simulation test. 10 | 11 | If you want to run the simulation test in command line on linux, you can configure the `makefile`: 12 | 13 | * `VIVADO_PATH` is the absolute path to your vivado executable file, eg. `/usr/local/Xilinx/Vivado/20xx.x/bin/vivado`. 14 | * `PROJECT_DIR` default is `.`, you can leave it alone. 15 | * `PROJECT_NAME` is the name of your vivado project which is equal to the name of `*.xpr` file without `.xpr` suffix. 16 | * `SIM` is the name of the simulation set you want to run. 17 | 18 | After proper configuration, you can use `make test` or simple `make` to run the simulation test. 19 | -------------------------------------------------------------------------------- /assignment-3(II)/src/bpb.v: -------------------------------------------------------------------------------- 1 | `include "bpb.vh" 2 | 3 | /** 4 | * ENTRIES : number of entries in the branch predictor buffer 5 | * TAG_WIDTH : index bits 6 | * instr_adr : if this address has been recorded, then CPU can go as the BPB directs 7 | * isbranch : in order to register the branch when first meeted 8 | * real_taken : whether this branch should be taken according to the semantics of the instructions 9 | * real_adr : where should this branch jumps to 10 | * predict_taken : whether this branch should be taken according to the prediction of our BPB 11 | * predict_adr : where should this branch jumps to if it's taken 12 | */ 13 | module bpb #( 14 | parameter ENTRIES = `BPB_E, 15 | parameter TAG_WIDTH = `BPB_T 16 | ) ( 17 | input clk, reset, stall, flush, 18 | input [TAG_WIDTH-1:0] instr_adr, 19 | 20 | input isbranch, 21 | // reality 22 | input real_taken, 23 | input [31:0] real_adr, 24 | // prediction 25 | output reg predict_taken, 26 | output reg [31:0] predict_adr 27 | ); 28 | 29 | /** 30 | * TODO: Your code here 31 | */ 32 | 33 | endmodule -------------------------------------------------------------------------------- /assignment-2/benchtest/testjr/testjr.in: -------------------------------------------------------------------------------- 1 | addi $sp, $0, 64 2 | addi $t0, $0, 10 3 | addi $t1, $0, 100 4 | 5 | test1: 6 | addi $a0, $0, 28 7 | addi $a0, $0, 36 8 | nop 9 | jr $a0 10 | sw $t0, 0($sp) 11 | j test2 12 | sw $t1, 0($sp) 13 | 14 | test2: 15 | addi $sp, $sp, -8 16 | addi $a0, $0, 56 17 | addi $a0, $0, 64 18 | jr $a0 19 | sw $t0, 0($sp) 20 | j test3 21 | sw $t1, 0($sp) 22 | 23 | test3: 24 | addi $sp, $sp, -8 25 | addi $a0, $0, 100 26 | sw $a0, 0($0) 27 | addi $a0, $0, 108 28 | sw $a0, 8($0) 29 | lw $a0, 0($0) 30 | lw $a0, 8($0) 31 | jr $a0 32 | sw $t0, 0($sp) 33 | j test4 34 | sw $t1, 0($sp) 35 | 36 | test4: 37 | addi $sp, $sp, -8 38 | addi $a0, $0, 144 39 | sw $a0, 16($0) 40 | addi $a0, $0, 136 41 | lw $a0, 16($0) 42 | jr $a0 43 | sw $t0, 0($sp) 44 | j test5 45 | sw $t1, 0($sp) 46 | 47 | test5: 48 | addi $t0, $0, 6 49 | sw $t0, 0($0) 50 | add $sp, $0, $0 51 | and $t1, $t1, $0 52 | Again: 53 | addi $t1, $t1, 6 54 | lw $t0, 0($sp) 55 | beq $t0, $t1, Again 56 | sw $t1, 4($0) 57 | 58 | test6: 59 | addi $t0, $0, 220 60 | sw $t0, 0($0) 61 | addi $t0, $0, 240 62 | sw $t0, 4($0) 63 | and $sp, $sp, $0 64 | and $t0, $t0, $0 65 | sw $0, 24($0) 66 | lw $t0, 0($sp) 67 | jr $t0 68 | sw $t0, 80($sp) 69 | lw $t0, 4($sp) 70 | addi $t0, $t0, -4 71 | jr $t0 72 | sw $t0, 84($sp) 73 | sw $t0, 12($0) 74 | nop 75 | nop 76 | nop 77 | nop 78 | -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/testjr/testjr.in: -------------------------------------------------------------------------------- 1 | addi $sp, $0, 64 2 | addi $t0, $0, 10 3 | addi $t1, $0, 100 4 | 5 | test1: 6 | addi $a0, $0, 28 7 | addi $a0, $0, 36 8 | nop 9 | jr $a0 10 | sw $t0, 0($sp) 11 | j test2 12 | sw $t1, 0($sp) 13 | 14 | test2: 15 | addi $sp, $sp, -8 16 | addi $a0, $0, 56 17 | addi $a0, $0, 64 18 | jr $a0 19 | sw $t0, 0($sp) 20 | j test3 21 | sw $t1, 0($sp) 22 | 23 | test3: 24 | addi $sp, $sp, -8 25 | addi $a0, $0, 100 26 | sw $a0, 0($0) 27 | addi $a0, $0, 108 28 | sw $a0, 8($0) 29 | lw $a0, 0($0) 30 | lw $a0, 8($0) 31 | jr $a0 32 | sw $t0, 0($sp) 33 | j test4 34 | sw $t1, 0($sp) 35 | 36 | test4: 37 | addi $sp, $sp, -8 38 | addi $a0, $0, 144 39 | sw $a0, 16($0) 40 | addi $a0, $0, 136 41 | lw $a0, 16($0) 42 | jr $a0 43 | sw $t0, 0($sp) 44 | j test5 45 | sw $t1, 0($sp) 46 | 47 | test5: 48 | addi $t0, $0, 6 49 | sw $t0, 0($0) 50 | add $sp, $0, $0 51 | and $t1, $t1, $0 52 | Again: 53 | addi $t1, $t1, 6 54 | lw $t0, 0($sp) 55 | beq $t0, $t1, Again 56 | sw $t1, 4($0) 57 | 58 | test6: 59 | addi $t0, $0, 220 60 | sw $t0, 0($0) 61 | addi $t0, $0, 240 62 | sw $t0, 4($0) 63 | and $sp, $sp, $0 64 | and $t0, $t0, $0 65 | sw $0, 24($0) 66 | lw $t0, 0($sp) 67 | jr $t0 68 | sw $t0, 80($sp) 69 | lw $t0, 4($sp) 70 | addi $t0, $t0, -4 71 | jr $t0 72 | sw $t0, 84($sp) 73 | sw $t0, 12($0) 74 | nop 75 | nop 76 | nop 77 | nop 78 | -------------------------------------------------------------------------------- /assignment-2/benchtest/factorial/factorial.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $sp, $0, 128 | 201d0080 2 | 0x4 : addi $a0, $0, 5 | 20040005 3 | 0x8 : addi $a1, $0, 0 | 20050000 4 | 0xc : jal factorial | 0c00000a 5 | 0x10 : sw $v0, 0($a1) | aca20000 6 | 0x14 : sll $v0, $v0, 1 | 00021040 7 | 0x18 : nop | 00000000 8 | 0x1c : nop | 00000000 9 | 0x20 : nop | 00000000 10 | 0x24 : nop | 00000000 11 | 0x28 : | 12 | 0x28 : factorial: | 13 | 0x28 : addi $sp, $sp, -8 | 23bdfff8 14 | 0x2c : sw $a0, 4($sp) | afa40004 15 | 0x30 : sw $ra, 0($sp) | afbf0000 16 | 0x34 : addi $t0, $0, 2 | 20080002 17 | 0x38 : slt $t0, $a0, $t0 | 0088402a 18 | 0x3c : beq $t0, $0 ,else | 10080003 19 | 0x40 : addi $v0, $0, 1 | 20020001 20 | 0x44 : addi $sp, $sp, 8 | 23bd0008 21 | 0x48 : jr $ra | 03e00008 22 | 0x4c : else: | 23 | 0x4c : addi $a0, $a0, -1 | 2084ffff 24 | 0x50 : jal factorial | 0c00000a 25 | 0x54 : lw $ra, 0($sp) | 8fbf0000 26 | 0x58 : lw $a0, 4($sp) | 8fa40004 27 | 0x5c : addi $sp, $sp, 8 | 23bd0008 28 | 0x60 : sw $v0, 0($a1) | aca20000 29 | 0x64 : add $v0, $a0, $v0 | 00821020 30 | 0x68 : addi $a1, $a1, 4 | 20a50004 31 | 0x6c : jr $ra | 03e00008 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/factorial/factorial.out: -------------------------------------------------------------------------------- 1 | 0x0 : addi $sp, $0, 128 | 201d0080 2 | 0x4 : addi $a0, $0, 5 | 20040005 3 | 0x8 : addi $a1, $0, 0 | 20050000 4 | 0xc : jal factorial | 0c00000a 5 | 0x10 : sw $v0, 0($a1) | aca20000 6 | 0x14 : sll $v0, $v0, 1 | 00021040 7 | 0x18 : nop | 00000000 8 | 0x1c : nop | 00000000 9 | 0x20 : nop | 00000000 10 | 0x24 : nop | 00000000 11 | 0x28 : | 12 | 0x28 : factorial: | 13 | 0x28 : addi $sp, $sp, -8 | 23bdfff8 14 | 0x2c : sw $a0, 4($sp) | afa40004 15 | 0x30 : sw $ra, 0($sp) | afbf0000 16 | 0x34 : addi $t0, $0, 2 | 20080002 17 | 0x38 : slt $t0, $a0, $t0 | 0088402a 18 | 0x3c : beq $t0, $0 ,else | 10080003 19 | 0x40 : addi $v0, $0, 1 | 20020001 20 | 0x44 : addi $sp, $sp, 8 | 23bd0008 21 | 0x48 : jr $ra | 03e00008 22 | 0x4c : else: | 23 | 0x4c : addi $a0, $a0, -1 | 2084ffff 24 | 0x50 : jal factorial | 0c00000a 25 | 0x54 : lw $ra, 0($sp) | 8fbf0000 26 | 0x58 : lw $a0, 4($sp) | 8fa40004 27 | 0x5c : addi $sp, $sp, 8 | 23bd0008 28 | 0x60 : sw $v0, 0($a1) | aca20000 29 | 0x64 : add $v0, $a0, $v0 | 00821020 30 | 0x68 : addi $a1, $a1, 4 | 20a50004 31 | 0x6c : jr $ra | 03e00008 -------------------------------------------------------------------------------- /assignment-2/benchtest/mutual recursion/mutual recursion.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20100000; 2 | RAM[1] <= 32'h20080066; 3 | RAM[2] <= 32'hae080000; 4 | RAM[3] <= 32'h20080067; 5 | RAM[4] <= 32'hae080004; 6 | RAM[5] <= 32'h20080066; 7 | RAM[6] <= 32'hae080008; 8 | RAM[7] <= 32'h20080067; 9 | RAM[8] <= 32'hae08000c; 10 | RAM[9] <= 32'h20080061; 11 | RAM[10] <= 32'hae080010; 12 | RAM[11] <= 32'h201d0080; 13 | RAM[12] <= 32'h20040000; 14 | RAM[13] <= 32'h0c000013; 15 | RAM[14] <= 32'h20510000; 16 | RAM[15] <= 32'h00000000; 17 | RAM[16] <= 32'h00000000; 18 | RAM[17] <= 32'h00000000; 19 | RAM[18] <= 32'h00000000; 20 | RAM[19] <= 32'h23bdfff8; 21 | RAM[20] <= 32'hafa40004; 22 | RAM[21] <= 32'hafbf0000; 23 | RAM[22] <= 32'h0004c880; 24 | RAM[23] <= 32'h0219c820; 25 | RAM[24] <= 32'h8f280000; 26 | RAM[25] <= 32'h20090061; 27 | RAM[26] <= 32'h15280002; 28 | RAM[27] <= 32'h20820001; 29 | RAM[28] <= 32'h08000023; 30 | RAM[29] <= 32'h20090066; 31 | RAM[30] <= 32'h15280003; 32 | RAM[31] <= 32'h20840001; 33 | RAM[32] <= 32'h0c000027; 34 | RAM[33] <= 32'h08000023; 35 | RAM[34] <= 32'h2002ffff; 36 | RAM[35] <= 32'h8fbf0000; 37 | RAM[36] <= 32'h8fa40004; 38 | RAM[37] <= 32'h23bd0008; 39 | RAM[38] <= 32'h03e00008; 40 | RAM[39] <= 32'h23bdfff8; 41 | RAM[40] <= 32'hafa40004; 42 | RAM[41] <= 32'hafbf0000; 43 | RAM[42] <= 32'h0004c880; 44 | RAM[43] <= 32'h0219c820; 45 | RAM[44] <= 32'h8f280000; 46 | RAM[45] <= 32'h20090067; 47 | RAM[46] <= 32'h15280003; 48 | RAM[47] <= 32'h20840001; 49 | RAM[48] <= 32'h0c000013; 50 | RAM[49] <= 32'h08000033; 51 | RAM[50] <= 32'h2002ffff; 52 | RAM[51] <= 32'h8fbf0000; 53 | RAM[52] <= 32'h8fa40004; 54 | RAM[53] <= 32'h23bd0008; 55 | RAM[54] <= 32'h03e00008; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/mutual recursion/mutual recursion.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h20100000; 2 | RAM[1] <= 32'h20080066; 3 | RAM[2] <= 32'hae080000; 4 | RAM[3] <= 32'h20080067; 5 | RAM[4] <= 32'hae080004; 6 | RAM[5] <= 32'h20080066; 7 | RAM[6] <= 32'hae080008; 8 | RAM[7] <= 32'h20080067; 9 | RAM[8] <= 32'hae08000c; 10 | RAM[9] <= 32'h20080061; 11 | RAM[10] <= 32'hae080010; 12 | RAM[11] <= 32'h201d0080; 13 | RAM[12] <= 32'h20040000; 14 | RAM[13] <= 32'h0c000013; 15 | RAM[14] <= 32'h20510000; 16 | RAM[15] <= 32'h00000000; 17 | RAM[16] <= 32'h00000000; 18 | RAM[17] <= 32'h00000000; 19 | RAM[18] <= 32'h00000000; 20 | RAM[19] <= 32'h23bdfff8; 21 | RAM[20] <= 32'hafa40004; 22 | RAM[21] <= 32'hafbf0000; 23 | RAM[22] <= 32'h0004c880; 24 | RAM[23] <= 32'h0219c820; 25 | RAM[24] <= 32'h8f280000; 26 | RAM[25] <= 32'h20090061; 27 | RAM[26] <= 32'h15280002; 28 | RAM[27] <= 32'h20820001; 29 | RAM[28] <= 32'h08000023; 30 | RAM[29] <= 32'h20090066; 31 | RAM[30] <= 32'h15280003; 32 | RAM[31] <= 32'h20840001; 33 | RAM[32] <= 32'h0c000027; 34 | RAM[33] <= 32'h08000023; 35 | RAM[34] <= 32'h2002ffff; 36 | RAM[35] <= 32'h8fbf0000; 37 | RAM[36] <= 32'h8fa40004; 38 | RAM[37] <= 32'h23bd0008; 39 | RAM[38] <= 32'h03e00008; 40 | RAM[39] <= 32'h23bdfff8; 41 | RAM[40] <= 32'hafa40004; 42 | RAM[41] <= 32'hafbf0000; 43 | RAM[42] <= 32'h0004c880; 44 | RAM[43] <= 32'h0219c820; 45 | RAM[44] <= 32'h8f280000; 46 | RAM[45] <= 32'h20090067; 47 | RAM[46] <= 32'h15280003; 48 | RAM[47] <= 32'h20840001; 49 | RAM[48] <= 32'h0c000013; 50 | RAM[49] <= 32'h08000033; 51 | RAM[50] <= 32'h2002ffff; 52 | RAM[51] <= 32'h8fbf0000; 53 | RAM[52] <= 32'h8fa40004; 54 | RAM[53] <= 32'h23bd0008; 55 | RAM[54] <= 32'h03e00008; -------------------------------------------------------------------------------- /assignment-3(I)/src/cache.v: -------------------------------------------------------------------------------- 1 | `include "cache.vh" 2 | 3 | /** 4 | * NOTE: The sum of TAG_WIDTH, SET_WIDTH and OFFSET_WIDTH should be 32 5 | * 6 | * TAG_WIDTH : (t) tag bits 7 | * SET_WIDTH : (s) set index bits, the number of sets is 2**SET_WIDTH 8 | * OFFSET_WIDTH : (b) block offset bits 9 | * LINES : number of lines per set 10 | * 11 | * stall : inorder to synchronize instruction memroy cache and data memroy cache, you may need this so that two caches will write data at most once per instruction respectively. 12 | * 13 | * input_ready : whether input data from processor are ready 14 | * addr : cache read/write address from processor 15 | * write_data : cache write data from processor 16 | * w_en : cache write enable 17 | * hit : whether cache hits 18 | * read_data : data read from cache 19 | * 20 | * maddr : memory address 21 | * mwrite_data : data written to memory 22 | * m_wen : memory write enable 23 | * mread_data : data read from memory 24 | */ 25 | module cache #( 26 | parameter TAG_WIDTH = `CACHE_T, 27 | SET_WIDTH = `CACHE_S, 28 | OFFSET_WIDTH = `CACHE_B, 29 | LINES = `CACHE_E 30 | )( 31 | input clk, reset, stall, 32 | 33 | // interface with CPU 34 | input input_ready, 35 | input [31:0] addr, write_data, 36 | input w_en, 37 | output hit, 38 | output [31:0] read_data, 39 | 40 | // interface with memory 41 | output [31:0] maddr, mwrite_data, 42 | output m_wen, 43 | input [31:0] mread_data 44 | /* input mready // memory ready ? */ 45 | ); 46 | 47 | /** 48 | * TODO: Your code here 49 | */ 50 | 51 | endmodule 52 | -------------------------------------------------------------------------------- /assignment-1/benchtest/bubble sort/bubble sort.run: -------------------------------------------------------------------------------- 1 | [0x0000007c]=0x0000005f 2 | [0x00000008]=0x0000004a 3 | [0x00000078]=0x00000052 4 | [0x0000000c]=0x00000026 5 | [0x00000074]=0x00000051 6 | [0x00000020]=0x00000024 7 | [0x00000070]=0x0000004b 8 | [0x00000058]=0x00000008 9 | [0x0000006c]=0x0000004b 10 | [0x00000050]=0x0000000d 11 | [0x00000068]=0x0000004a 12 | [0x00000010]=0x00000012 13 | [0x00000064]=0x0000004a 14 | [0x00000008]=0x0000003e 15 | [0x00000060]=0x00000049 16 | [0x00000034]=0x00000028 17 | [0x0000005c]=0x00000046 18 | [0x00000040]=0x00000007 19 | [0x00000058]=0x00000044 20 | [0x00000044]=0x00000008 21 | [0x00000054]=0x00000042 22 | [0x00000014]=0x00000030 23 | [0x00000050]=0x0000003e 24 | [0x00000008]=0x0000000d 25 | [0x0000004c]=0x00000034 26 | [0x00000004]=0x0000002c 27 | [0x00000048]=0x00000030 28 | [0x00000014]=0x00000019 29 | [0x00000044]=0x0000002c 30 | [0x00000004]=0x00000008 31 | [0x00000040]=0x00000028 32 | [0x00000034]=0x00000007 33 | [0x0000003c]=0x00000027 34 | [0x0000003c]=0x00000027 35 | [0x00000038]=0x00000026 36 | [0x0000000c]=0x0000001d 37 | [0x00000034]=0x00000024 38 | [0x00000020]=0x00000007 39 | [0x00000030]=0x0000001f 40 | [0x00000030]=0x0000001f 41 | [0x0000002c]=0x0000001d 42 | [0x0000000c]=0x0000001c 43 | [0x00000028]=0x0000001c 44 | [0x0000000c]=0x00000002 45 | [0x00000024]=0x0000001b 46 | [0x0000001c]=0x00000009 47 | [0x00000020]=0x00000019 48 | [0x00000014]=0x00000007 49 | [0x0000001c]=0x00000012 50 | [0x00000010]=0x00000009 51 | [0x00000018]=0x0000000d 52 | [0x00000008]=0x00000001 53 | [0x00000014]=0x00000009 54 | [0x00000010]=0x00000007 55 | [0x00000010]=0x00000008 56 | [0x00000004]=0x00000007 57 | [0x0000000c]=0x00000007 58 | [0x00000004]=0x00000002 59 | [0x00000008]=0x00000007 60 | [0x00000000]=0x00000001 61 | [0x00000004]=0x00000002 62 | [0x00000004]=0x00000002 63 | [0x00000000]=0x00000001 64 | [0x00000000]=0x00000001 -------------------------------------------------------------------------------- /assignment-2/benchtest/bubble sort/bubble sort.run: -------------------------------------------------------------------------------- 1 | [0x0000007c]=0x0000005f 2 | [0x00000008]=0x0000004a 3 | [0x00000078]=0x00000052 4 | [0x0000000c]=0x00000026 5 | [0x00000074]=0x00000051 6 | [0x00000020]=0x00000024 7 | [0x00000070]=0x0000004b 8 | [0x00000058]=0x00000008 9 | [0x0000006c]=0x0000004b 10 | [0x00000050]=0x0000000d 11 | [0x00000068]=0x0000004a 12 | [0x00000010]=0x00000012 13 | [0x00000064]=0x0000004a 14 | [0x00000008]=0x0000003e 15 | [0x00000060]=0x00000049 16 | [0x00000034]=0x00000028 17 | [0x0000005c]=0x00000046 18 | [0x00000040]=0x00000007 19 | [0x00000058]=0x00000044 20 | [0x00000044]=0x00000008 21 | [0x00000054]=0x00000042 22 | [0x00000014]=0x00000030 23 | [0x00000050]=0x0000003e 24 | [0x00000008]=0x0000000d 25 | [0x0000004c]=0x00000034 26 | [0x00000004]=0x0000002c 27 | [0x00000048]=0x00000030 28 | [0x00000014]=0x00000019 29 | [0x00000044]=0x0000002c 30 | [0x00000004]=0x00000008 31 | [0x00000040]=0x00000028 32 | [0x00000034]=0x00000007 33 | [0x0000003c]=0x00000027 34 | [0x0000003c]=0x00000027 35 | [0x00000038]=0x00000026 36 | [0x0000000c]=0x0000001d 37 | [0x00000034]=0x00000024 38 | [0x00000020]=0x00000007 39 | [0x00000030]=0x0000001f 40 | [0x00000030]=0x0000001f 41 | [0x0000002c]=0x0000001d 42 | [0x0000000c]=0x0000001c 43 | [0x00000028]=0x0000001c 44 | [0x0000000c]=0x00000002 45 | [0x00000024]=0x0000001b 46 | [0x0000001c]=0x00000009 47 | [0x00000020]=0x00000019 48 | [0x00000014]=0x00000007 49 | [0x0000001c]=0x00000012 50 | [0x00000010]=0x00000009 51 | [0x00000018]=0x0000000d 52 | [0x00000008]=0x00000001 53 | [0x00000014]=0x00000009 54 | [0x00000010]=0x00000007 55 | [0x00000010]=0x00000008 56 | [0x00000004]=0x00000007 57 | [0x0000000c]=0x00000007 58 | [0x00000004]=0x00000002 59 | [0x00000008]=0x00000007 60 | [0x00000000]=0x00000001 61 | [0x00000004]=0x00000002 62 | [0x00000004]=0x00000002 63 | [0x00000000]=0x00000001 64 | [0x00000000]=0x00000001 -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/bubble sort/bubble sort.run: -------------------------------------------------------------------------------- 1 | [0x0000007c]=0x0000005f 2 | [0x00000008]=0x0000004a 3 | [0x00000078]=0x00000052 4 | [0x0000000c]=0x00000026 5 | [0x00000074]=0x00000051 6 | [0x00000020]=0x00000024 7 | [0x00000070]=0x0000004b 8 | [0x00000058]=0x00000008 9 | [0x0000006c]=0x0000004b 10 | [0x00000050]=0x0000000d 11 | [0x00000068]=0x0000004a 12 | [0x00000010]=0x00000012 13 | [0x00000064]=0x0000004a 14 | [0x00000008]=0x0000003e 15 | [0x00000060]=0x00000049 16 | [0x00000034]=0x00000028 17 | [0x0000005c]=0x00000046 18 | [0x00000040]=0x00000007 19 | [0x00000058]=0x00000044 20 | [0x00000044]=0x00000008 21 | [0x00000054]=0x00000042 22 | [0x00000014]=0x00000030 23 | [0x00000050]=0x0000003e 24 | [0x00000008]=0x0000000d 25 | [0x0000004c]=0x00000034 26 | [0x00000004]=0x0000002c 27 | [0x00000048]=0x00000030 28 | [0x00000014]=0x00000019 29 | [0x00000044]=0x0000002c 30 | [0x00000004]=0x00000008 31 | [0x00000040]=0x00000028 32 | [0x00000034]=0x00000007 33 | [0x0000003c]=0x00000027 34 | [0x0000003c]=0x00000027 35 | [0x00000038]=0x00000026 36 | [0x0000000c]=0x0000001d 37 | [0x00000034]=0x00000024 38 | [0x00000020]=0x00000007 39 | [0x00000030]=0x0000001f 40 | [0x00000030]=0x0000001f 41 | [0x0000002c]=0x0000001d 42 | [0x0000000c]=0x0000001c 43 | [0x00000028]=0x0000001c 44 | [0x0000000c]=0x00000002 45 | [0x00000024]=0x0000001b 46 | [0x0000001c]=0x00000009 47 | [0x00000020]=0x00000019 48 | [0x00000014]=0x00000007 49 | [0x0000001c]=0x00000012 50 | [0x00000010]=0x00000009 51 | [0x00000018]=0x0000000d 52 | [0x00000008]=0x00000001 53 | [0x00000014]=0x00000009 54 | [0x00000010]=0x00000007 55 | [0x00000010]=0x00000008 56 | [0x00000004]=0x00000007 57 | [0x0000000c]=0x00000007 58 | [0x00000004]=0x00000002 59 | [0x00000008]=0x00000007 60 | [0x00000000]=0x00000001 61 | [0x00000004]=0x00000002 62 | [0x00000004]=0x00000002 63 | [0x00000000]=0x00000001 64 | [0x00000000]=0x00000001 -------------------------------------------------------------------------------- /assignment-2/benchtest/testjr/testjr.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h201d0040; 2 | RAM[1] <= 32'h2008000a; 3 | RAM[2] <= 32'h20090064; 4 | RAM[3] <= 32'h2004001c; 5 | RAM[4] <= 32'h20040024; 6 | RAM[5] <= 32'h00000000; 7 | RAM[6] <= 32'h00800008; 8 | RAM[7] <= 32'hafa80000; 9 | RAM[8] <= 32'h0800000a; 10 | RAM[9] <= 32'hafa90000; 11 | RAM[10] <= 32'h23bdfff8; 12 | RAM[11] <= 32'h20040038; 13 | RAM[12] <= 32'h20040040; 14 | RAM[13] <= 32'h00800008; 15 | RAM[14] <= 32'hafa80000; 16 | RAM[15] <= 32'h08000011; 17 | RAM[16] <= 32'hafa90000; 18 | RAM[17] <= 32'h23bdfff8; 19 | RAM[18] <= 32'h20040064; 20 | RAM[19] <= 32'hac040000; 21 | RAM[20] <= 32'h2004006c; 22 | RAM[21] <= 32'hac040008; 23 | RAM[22] <= 32'h8c040000; 24 | RAM[23] <= 32'h8c040008; 25 | RAM[24] <= 32'h00800008; 26 | RAM[25] <= 32'hafa80000; 27 | RAM[26] <= 32'h0800001c; 28 | RAM[27] <= 32'hafa90000; 29 | RAM[28] <= 32'h23bdfff8; 30 | RAM[29] <= 32'h20040090; 31 | RAM[30] <= 32'hac040010; 32 | RAM[31] <= 32'h20040088; 33 | RAM[32] <= 32'h8c040010; 34 | RAM[33] <= 32'h00800008; 35 | RAM[34] <= 32'hafa80000; 36 | RAM[35] <= 32'h08000025; 37 | RAM[36] <= 32'hafa90000; 38 | RAM[37] <= 32'h20080006; 39 | RAM[38] <= 32'hac080000; 40 | RAM[39] <= 32'h0000e820; 41 | RAM[40] <= 32'h01204824; 42 | RAM[41] <= 32'h21290006; 43 | RAM[42] <= 32'h8fa80000; 44 | RAM[43] <= 32'h1128fffd; 45 | RAM[44] <= 32'hac090004; 46 | RAM[45] <= 32'h200800dc; 47 | RAM[46] <= 32'hac080000; 48 | RAM[47] <= 32'h200800f0; 49 | RAM[48] <= 32'hac080004; 50 | RAM[49] <= 32'h03a0e824; 51 | RAM[50] <= 32'h01004024; 52 | RAM[51] <= 32'hac000018; 53 | RAM[52] <= 32'h8fa80000; 54 | RAM[53] <= 32'h01000008; 55 | RAM[54] <= 32'hafa80050; 56 | RAM[55] <= 32'h8fa80004; 57 | RAM[56] <= 32'h2108fffc; 58 | RAM[57] <= 32'h01000008; 59 | RAM[58] <= 32'hafa80054; 60 | RAM[59] <= 32'hac08000c; 61 | RAM[60] <= 32'h00000000; 62 | RAM[61] <= 32'h00000000; 63 | RAM[62] <= 32'h00000000; 64 | RAM[63] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/testjr/testjr.txt: -------------------------------------------------------------------------------- 1 | RAM[0] <= 32'h201d0040; 2 | RAM[1] <= 32'h2008000a; 3 | RAM[2] <= 32'h20090064; 4 | RAM[3] <= 32'h2004001c; 5 | RAM[4] <= 32'h20040024; 6 | RAM[5] <= 32'h00000000; 7 | RAM[6] <= 32'h00800008; 8 | RAM[7] <= 32'hafa80000; 9 | RAM[8] <= 32'h0800000a; 10 | RAM[9] <= 32'hafa90000; 11 | RAM[10] <= 32'h23bdfff8; 12 | RAM[11] <= 32'h20040038; 13 | RAM[12] <= 32'h20040040; 14 | RAM[13] <= 32'h00800008; 15 | RAM[14] <= 32'hafa80000; 16 | RAM[15] <= 32'h08000011; 17 | RAM[16] <= 32'hafa90000; 18 | RAM[17] <= 32'h23bdfff8; 19 | RAM[18] <= 32'h20040064; 20 | RAM[19] <= 32'hac040000; 21 | RAM[20] <= 32'h2004006c; 22 | RAM[21] <= 32'hac040008; 23 | RAM[22] <= 32'h8c040000; 24 | RAM[23] <= 32'h8c040008; 25 | RAM[24] <= 32'h00800008; 26 | RAM[25] <= 32'hafa80000; 27 | RAM[26] <= 32'h0800001c; 28 | RAM[27] <= 32'hafa90000; 29 | RAM[28] <= 32'h23bdfff8; 30 | RAM[29] <= 32'h20040090; 31 | RAM[30] <= 32'hac040010; 32 | RAM[31] <= 32'h20040088; 33 | RAM[32] <= 32'h8c040010; 34 | RAM[33] <= 32'h00800008; 35 | RAM[34] <= 32'hafa80000; 36 | RAM[35] <= 32'h08000025; 37 | RAM[36] <= 32'hafa90000; 38 | RAM[37] <= 32'h20080006; 39 | RAM[38] <= 32'hac080000; 40 | RAM[39] <= 32'h0000e820; 41 | RAM[40] <= 32'h01204824; 42 | RAM[41] <= 32'h21290006; 43 | RAM[42] <= 32'h8fa80000; 44 | RAM[43] <= 32'h1128fffd; 45 | RAM[44] <= 32'hac090004; 46 | RAM[45] <= 32'h200800dc; 47 | RAM[46] <= 32'hac080000; 48 | RAM[47] <= 32'h200800f0; 49 | RAM[48] <= 32'hac080004; 50 | RAM[49] <= 32'h03a0e824; 51 | RAM[50] <= 32'h01004024; 52 | RAM[51] <= 32'hac000018; 53 | RAM[52] <= 32'h8fa80000; 54 | RAM[53] <= 32'h01000008; 55 | RAM[54] <= 32'hafa80050; 56 | RAM[55] <= 32'h8fa80004; 57 | RAM[56] <= 32'h2108fffc; 58 | RAM[57] <= 32'h01000008; 59 | RAM[58] <= 32'hafa80054; 60 | RAM[59] <= 32'hac08000c; 61 | RAM[60] <= 32'h00000000; 62 | RAM[61] <= 32'h00000000; 63 | RAM[62] <= 32'h00000000; 64 | RAM[63] <= 32'h00000000; -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/random write/random write.ans: -------------------------------------------------------------------------------- 1 | 00000040 2 | 0000001f 3 | 00000013 4 | 0000001e 5 | 00000000 6 | 0000001f 7 | 0000001b 8 | 0000001a 9 | 00000015 10 | 0000001f 11 | 00000015 12 | 0000001e 13 | 0000001b 14 | 0000001f 15 | 00000000 16 | 0000001d 17 | 00000013 18 | 0000001e 19 | 00000011 20 | 0000001b 21 | 0000001d 22 | 00000014 23 | 00000017 24 | 00000000 25 | 00000000 26 | 0000001e 27 | 0000001b 28 | 0000001d 29 | 00000000 30 | 0000001c 31 | 00000000 32 | 0000001a 33 | 0000001d 34 | 0000001e 35 | 00000019 36 | 0000001a 37 | 0000001f 38 | 00000019 39 | 00000000 40 | 0000001b 41 | 0000001f 42 | 0000001e 43 | 00000017 44 | 00000011 45 | 0000001f 46 | 0000001c 47 | 0000001b 48 | 00000000 49 | 0000001f 50 | 0000001d 51 | 00000015 52 | 00000016 53 | 00000015 54 | 0000001b 55 | 00000015 56 | 0000001e 57 | 0000001d 58 | 0000001c 59 | 00000000 60 | 0000001a 61 | 00000011 62 | 0000001d 63 | 00000019 64 | 0000001e 65 | 00000000 66 | 00000018 67 | 0000001b 68 | 0000001f 69 | 00000017 70 | 0000001c 71 | 00000000 72 | 0000001f 73 | 00000000 74 | 0000001d 75 | 00000000 76 | 0000001f 77 | 00000000 78 | 00000016 79 | 00000017 80 | 0000001f 81 | 0000001b 82 | 00000019 83 | 00000000 84 | 0000001a 85 | 00000019 86 | 0000001e 87 | 00000011 88 | 0000001a 89 | 00000000 90 | 0000001c 91 | 0000001d 92 | 00000017 93 | 00000015 94 | 0000001e 95 | 00000015 96 | 00000016 97 | 00000015 98 | 0000001c 99 | 0000001f 100 | 00000016 101 | 0000001b 102 | 0000001e 103 | 0000001f 104 | 00000011 105 | 00000017 106 | 00000018 107 | 0000001f 108 | 0000001b 109 | 00000000 110 | 0000001e 111 | 0000001f 112 | 0000001a 113 | 00000019 114 | 0000001c 115 | 0000001d 116 | 0000001e 117 | 00000000 118 | 0000001c 119 | 00000000 120 | 0000001d 121 | 0000001b 122 | 00000018 123 | 00000000 124 | 0000001e 125 | 00000017 126 | 00000013 127 | 0000001d 128 | 0000001b 129 | 00000011 130 | -------------------------------------------------------------------------------- /assignment-2/benchtest/mutual recursion/mutual recursion.in: -------------------------------------------------------------------------------- 1 | # 在编译原理的语法分析中,很多文法都是递归形式给出的。 2 | # 假设有如下文法: 3 | # G[F]: 4 | # F → fG | a 5 | # G → gF 6 | # 判断字符串 a 是否满足的程序如下: 7 | # 8 | # int F(int pos) 9 | # { 10 | # if(a[pos] == 'a') return pos+1; 11 | # if(a[pos] == 'f') return G(pos+1); 12 | # return -1; 13 | # } 14 | # 15 | # int G(int pos) 16 | # { 17 | # if(a[pos] == 'g') return F(pos+1); 18 | # return -1; 19 | # } 20 | # b = F(0); 21 | 22 | # 将字符串"fgfga"置入从0x00000000($s0)开始的空间 23 | # 因为不支持sb指令,所以用sw代替 24 | addi $s0, $0, 0 25 | addi $t0, $0, 102 26 | sw $t0, 0($s0) 27 | addi $t0, $0, 103 28 | sw $t0, 4($s0) 29 | addi $t0, $0, 102 30 | sw $t0, 8($s0) 31 | addi $t0, $0, 103 32 | sw $t0, 12($s0) 33 | addi $t0, $0, 97 34 | sw $t0, 16($s0) 35 | # 初始化栈指针 36 | addi $sp, $0, 128 37 | 38 | # 调用F(0)。调用返回后,将返回值($v0)存入变量b($s1)。 39 | addi $a0, $0, 0 40 | jal F 41 | addi $s1, $v0, 0 42 | nop 43 | nop 44 | nop 45 | nop 46 | 47 | F: 48 | # 申请栈帧空间,存储保留寄存器 49 | addi $sp, $sp, -8 50 | sw $a0, 4($sp) 51 | sw $ra, 0($sp) 52 | 53 | # 读取a[pos] 54 | sll $t9, $a0, 2 55 | add $t9, $s0, $t9 56 | lw $t0, 0($t9) 57 | 58 | # 第一个if语句 59 | addi $t1, $0, 97 60 | bne $t0, $t1, F1 61 | # 设定返回值 62 | addi $v0, $a0, 1 63 | j F_ret 64 | 65 | F1: 66 | # 第二个if语句 67 | addi $t1, $0, 102 68 | bne $t0, $t1, F2 69 | addi $a0, $a0, 1 70 | jal G 71 | j F_ret 72 | 73 | F2: 74 | addi $v0, $0, -1 75 | F_ret: 76 | # 释放栈帧空间,恢复保留寄存器 77 | lw $ra, 0($sp) 78 | lw $a0, 4($sp) 79 | addi $sp, $sp, 8 80 | jr $ra 81 | 82 | G: 83 | addi $sp, $sp, -8 84 | sw $a0, 4($sp) 85 | sw $ra, 0($sp) 86 | 87 | sll $t9, $a0, 2 88 | add $t9, $s0, $t9 89 | lw $t0, 0($t9) 90 | 91 | addi $t1, $0, 103 92 | bne $t0, $t1, G1 93 | addi $a0, $a0, 1 94 | jal F 95 | j G_ret 96 | 97 | G1: 98 | addi $v0, $0, -1 99 | G_ret: 100 | lw $ra, 0($sp) 101 | lw $a0, 4($sp) 102 | addi $sp, $sp, 8 103 | jr $ra 104 | -------------------------------------------------------------------------------- /assignment-3(I)/benchtest/mutual recursion/mutual recursion.in: -------------------------------------------------------------------------------- 1 | # 在编译原理的语法分析中,很多文法都是递归形式给出的。 2 | # 假设有如下文法: 3 | # G[F]: 4 | # F → fG | a 5 | # G → gF 6 | # 判断字符串 a 是否满足的程序如下: 7 | # 8 | # int F(int pos) 9 | # { 10 | # if(a[pos] == 'a') return pos+1; 11 | # if(a[pos] == 'f') return G(pos+1); 12 | # return -1; 13 | # } 14 | # 15 | # int G(int pos) 16 | # { 17 | # if(a[pos] == 'g') return F(pos+1); 18 | # return -1; 19 | # } 20 | # b = F(0); 21 | 22 | # 将字符串"fgfga"置入从0x00000000($s0)开始的空间 23 | # 因为不支持sb指令,所以用sw代替 24 | addi $s0, $0, 0 25 | addi $t0, $0, 102 26 | sw $t0, 0($s0) 27 | addi $t0, $0, 103 28 | sw $t0, 4($s0) 29 | addi $t0, $0, 102 30 | sw $t0, 8($s0) 31 | addi $t0, $0, 103 32 | sw $t0, 12($s0) 33 | addi $t0, $0, 97 34 | sw $t0, 16($s0) 35 | # 初始化栈指针 36 | addi $sp, $0, 128 37 | 38 | # 调用F(0)。调用返回后,将返回值($v0)存入变量b($s1)。 39 | addi $a0, $0, 0 40 | jal F 41 | addi $s1, $v0, 0 42 | nop 43 | nop 44 | nop 45 | nop 46 | 47 | F: 48 | # 申请栈帧空间,存储保留寄存器 49 | addi $sp, $sp, -8 50 | sw $a0, 4($sp) 51 | sw $ra, 0($sp) 52 | 53 | # 读取a[pos] 54 | sll $t9, $a0, 2 55 | add $t9, $s0, $t9 56 | lw $t0, 0($t9) 57 | 58 | # 第一个if语句 59 | addi $t1, $0, 97 60 | bne $t0, $t1, F1 61 | # 设定返回值 62 | addi $v0, $a0, 1 63 | j F_ret 64 | 65 | F1: 66 | # 第二个if语句 67 | addi $t1, $0, 102 68 | bne $t0, $t1, F2 69 | addi $a0, $a0, 1 70 | jal G 71 | j F_ret 72 | 73 | F2: 74 | addi $v0, $0, -1 75 | F_ret: 76 | # 释放栈帧空间,恢复保留寄存器 77 | lw $ra, 0($sp) 78 | lw $a0, 4($sp) 79 | addi $sp, $sp, 8 80 | jr $ra 81 | 82 | G: 83 | addi $sp, $sp, -8 84 | sw $a0, 4($sp) 85 | sw $ra, 0($sp) 86 | 87 | sll $t9, $a0, 2 88 | add $t9, $s0, $t9 89 | lw $t0, 0($t9) 90 | 91 | addi $t1, $0, 103 92 | bne $t0, $t1, G1 93 | addi $a0, $a0, 1 94 | jal F 95 | j G_ret 96 | 97 | G1: 98 | addi $v0, $0, -1 99 | G_ret: 100 | lw $ra, 0($sp) 101 | lw $a0, 4($sp) 102 | addi $sp, $sp, 8 103 | jr $ra 104 | -------------------------------------------------------------------------------- /assignment-1/index.md: -------------------------------------------------------------------------------- 1 | ##
30 |
31 | In assignment-2, we've taken advantage of some techniques to improve our CPU, such as forwarding and bypassing, or even simple branch scheduling and prediction to decrease the CPI (due to the inherent features of our programs, always taken may have round a 60% success rate[^ICS]).
32 |
33 | [^ICS]:http://csappbook.blogspot.com/
34 |
35 | However, that's still far from how the industry is doing, since for typical RISC programs, the average dynamic branch frequency is often between 15% and 25%, meaning that 3-6 instructions execute between a pair of branches[^CAAQA]. When we only consider the stalls caused by branch, we will have at least 1 + 0.4 \* 0.2 = 1.08 CPI, while state-of-the-art pipeline with BPB can have 90% accuracy (do not consider the hit rate), which means we can get 1 + 0.1 \* 0.2 = 1.02 CPI based on the classic 5-stage pipeline. With the introduction of Superscalar and IPC (Instructions per cycle), the performance differential may even grow larger.
36 |
37 | Although branch predictor is promising, it also incurs new challenge.
38 | $$
39 | \mbox{CPU time} = \frac{\mbox{Seconds}}{\mbox{Program}} = \frac{\mbox{Instructions}}{\mbox{Program}}\times\frac{\mbox{Clock cycles}}{\mbox{Instruction}}\times\frac{\mbox{Seconds}}{\mbox{Clock cycles}}
40 | $$
41 | Modern architecture's depth has been designed as more than 5 stages to lower the third item, thus leading to the extremely high misprediction penalty. Take the Intel Core i7 pipeline structure as an example, the total pipeline depth is 14 stages, with branch mispredictions typically costing 17 cycles[^CAAQA]. To obtain better performance, thus we need more sophisticated branch prediction mechanisms.
42 |
43 | **Hint**: In this part, you have to at least design a 2-bit predictor scheme, while other strategies are also welcomed.
44 |
45 | #### BPB Module
46 |
47 | Our BPB offers another choice for the update of PC, meanwhile, BPB should watch cautiously how CPU is going. You need to implement `bpb` module defined as below.
48 |
49 | ```verilog
50 | `include "bpb.vh"
51 |
52 | /**
53 | * ENTRIES : number of entries in the branch predictor buffer
54 | * TAG_WIDTH : index bits
55 | * instr_adr : if this address has been recorded, then CPU can go as the BPB directs
56 | * isbranch : in order to register the branch when first meeted
57 | * real_taken : whether this branch should be taken according to the semantics of the instructions
58 | * real_adr : where should this branch jumps to
59 | * predict_taken : whether this branch should be taken according to the prediction of our BPB
60 | * predict_adr : where should this branch jumps to if it's taken
61 | */
62 | module bpb #(
63 | parameter ENTRIES = `BPB_E,
64 | parameter TAG_WIDTH = `BPB_T
65 | ) (
66 | input clk, reset, stall, flush,
67 | input [TAG_WIDTH-1:0] instr_adr,
68 |
69 | input isbranch,
70 | // reality
71 | input real_taken,
72 | input [31:0] real_adr,
73 | // prediction
74 | output reg predict_taken,
75 | output reg [31:0] predict_adr
76 | );
77 |
78 | /**
79 | * TODO: Your code here
80 | */
81 |
82 | endmodule
83 | ```
84 |
85 | I recommend you to design a structure like `cache` which can scale well when we change the parameters, and separating the controller module out can give you more flexibility to change your strategy. Due to its simplicity, we will not give further setting, and it's your time to design.
86 |
87 | #### Report Requirements
88 |
89 | - There's no need to include simulation results (e.g. wave plots) in your report, since you have passed all the benchtests.
90 | - You need state how your predictor works and draw the state diagram and state-transition table by yourself and include them in your report.
91 | - For the sake of intellectual property, you should list all the references, especially the pictures you include in the report (It's recommended to draw pictures on your own).
92 |
93 | - You are encouraged to implement a parameter-defined predictor (5% bonus) and to implement different prediction mechanisms (15%) and run benchtests to test the performance and give analysis.
94 | - You are encouraged to offer some interesting and useful benchtests used for BPB (not included in ours) in your report (no more than 5% bonus).
95 |
96 |
--------------------------------------------------------------------------------
/assignment-3(I)/benchtest/random write/random write.run:
--------------------------------------------------------------------------------
1 | [0x00000044]=0x00000011
2 | [0x00000088]=0x00000011
3 | [0x000000cc]=0x00000011
4 | [0x00000110]=0x00000011
5 | [0x00000154]=0x00000011
6 | [0x00000198]=0x00000011
7 | [0x000001dc]=0x00000011
8 | [0x00000020]=0x00000011
9 | [0x00000064]=0x00000011
10 | [0x000000a8]=0x00000011
11 | [0x000000ec]=0x00000011
12 | [0x00000130]=0x00000011
13 | [0x00000174]=0x00000011
14 | [0x000001b8]=0x00000011
15 | [0x000001fc]=0x00000011
16 | [0x00000040]=0x00000011
17 | [0x00000088]=0x00000012
18 | [0x000000d0]=0x00000012
19 | [0x00000118]=0x00000012
20 | [0x00000160]=0x00000012
21 | [0x000001a8]=0x00000012
22 | [0x000001f0]=0x00000012
23 | [0x00000038]=0x00000012
24 | [0x00000080]=0x00000012
25 | [0x000000c8]=0x00000012
26 | [0x00000110]=0x00000012
27 | [0x00000158]=0x00000012
28 | [0x000001a0]=0x00000012
29 | [0x000001e8]=0x00000012
30 | [0x00000030]=0x00000012
31 | [0x00000078]=0x00000012
32 | [0x000000c0]=0x00000012
33 | [0x0000010c]=0x00000013
34 | [0x00000158]=0x00000013
35 | [0x000001a4]=0x00000013
36 | [0x000001f0]=0x00000013
37 | [0x0000003c]=0x00000013
38 | [0x00000088]=0x00000013
39 | [0x000000d4]=0x00000013
40 | [0x00000120]=0x00000013
41 | [0x0000016c]=0x00000013
42 | [0x000001b8]=0x00000013
43 | [0x00000004]=0x00000013
44 | [0x00000050]=0x00000013
45 | [0x0000009c]=0x00000013
46 | [0x000000e8]=0x00000013
47 | [0x00000134]=0x00000013
48 | [0x00000180]=0x00000013
49 | [0x000001d0]=0x00000014
50 | [0x00000020]=0x00000014
51 | [0x00000070]=0x00000014
52 | [0x000000c0]=0x00000014
53 | [0x00000110]=0x00000014
54 | [0x00000160]=0x00000014
55 | [0x000001b0]=0x00000014
56 | [0x00000000]=0x00000014
57 | [0x00000050]=0x00000014
58 | [0x000000a0]=0x00000014
59 | [0x000000f0]=0x00000014
60 | [0x00000140]=0x00000014
61 | [0x00000190]=0x00000014
62 | [0x000001e0]=0x00000014
63 | [0x00000030]=0x00000014
64 | [0x00000080]=0x00000014
65 | [0x000000d4]=0x00000015
66 | [0x00000128]=0x00000015
67 | [0x0000017c]=0x00000015
68 | [0x000001d0]=0x00000015
69 | [0x00000024]=0x00000015
70 | [0x00000078]=0x00000015
71 | [0x000000cc]=0x00000015
72 | [0x00000120]=0x00000015
73 | [0x00000174]=0x00000015
74 | [0x000001c8]=0x00000015
75 | [0x0000001c]=0x00000015
76 | [0x00000070]=0x00000015
77 | [0x000000c4]=0x00000015
78 | [0x00000118]=0x00000015
79 | [0x0000016c]=0x00000015
80 | [0x000001c0]=0x00000015
81 | [0x00000018]=0x00000016
82 | [0x00000070]=0x00000016
83 | [0x000000c8]=0x00000016
84 | [0x00000120]=0x00000016
85 | [0x00000178]=0x00000016
86 | [0x000001d0]=0x00000016
87 | [0x00000028]=0x00000016
88 | [0x00000080]=0x00000016
89 | [0x000000d8]=0x00000016
90 | [0x00000130]=0x00000016
91 | [0x00000188]=0x00000016
92 | [0x000001e0]=0x00000016
93 | [0x00000038]=0x00000016
94 | [0x00000090]=0x00000016
95 | [0x000000e8]=0x00000016
96 | [0x00000140]=0x00000016
97 | [0x0000019c]=0x00000017
98 | [0x000001f8]=0x00000017
99 | [0x00000054]=0x00000017
100 | [0x000000b0]=0x00000017
101 | [0x0000010c]=0x00000017
102 | [0x00000168]=0x00000017
103 | [0x000001c4]=0x00000017
104 | [0x00000020]=0x00000017
105 | [0x0000007c]=0x00000017
106 | [0x000000d8]=0x00000017
107 | [0x00000134]=0x00000017
108 | [0x00000190]=0x00000017
109 | [0x000001ec]=0x00000017
110 | [0x00000048]=0x00000017
111 | [0x000000a4]=0x00000017
112 | [0x00000100]=0x00000017
113 | [0x00000160]=0x00000018
114 | [0x000001c0]=0x00000018
115 | [0x00000020]=0x00000018
116 | [0x00000080]=0x00000018
117 | [0x000000e0]=0x00000018
118 | [0x00000140]=0x00000018
119 | [0x000001a0]=0x00000018
120 | [0x00000000]=0x00000018
121 | [0x00000060]=0x00000018
122 | [0x000000c0]=0x00000018
123 | [0x00000120]=0x00000018
124 | [0x00000180]=0x00000018
125 | [0x000001e0]=0x00000018
126 | [0x00000040]=0x00000018
127 | [0x000000a0]=0x00000018
128 | [0x00000100]=0x00000018
129 | [0x00000164]=0x00000019
130 | [0x000001c8]=0x00000019
131 | [0x0000002c]=0x00000019
132 | [0x00000090]=0x00000019
133 | [0x000000f4]=0x00000019
134 | [0x00000158]=0x00000019
135 | [0x000001bc]=0x00000019
136 | [0x00000020]=0x00000019
137 | [0x00000084]=0x00000019
138 | [0x000000e8]=0x00000019
139 | [0x0000014c]=0x00000019
140 | [0x000001b0]=0x00000019
141 | [0x00000014]=0x00000019
142 | [0x00000078]=0x00000019
143 | [0x000000dc]=0x00000019
144 | [0x00000140]=0x00000019
145 | [0x000001a8]=0x0000001a
146 | [0x00000010]=0x0000001a
147 | [0x00000078]=0x0000001a
148 | [0x000000e0]=0x0000001a
149 | [0x00000148]=0x0000001a
150 | [0x000001b0]=0x0000001a
151 | [0x00000018]=0x0000001a
152 | [0x00000080]=0x0000001a
153 | [0x000000e8]=0x0000001a
154 | [0x00000150]=0x0000001a
155 | [0x000001b8]=0x0000001a
156 | [0x00000020]=0x0000001a
157 | [0x00000088]=0x0000001a
158 | [0x000000f0]=0x0000001a
159 | [0x00000158]=0x0000001a
160 | [0x000001c0]=0x0000001a
161 | [0x0000002c]=0x0000001b
162 | [0x00000098]=0x0000001b
163 | [0x00000104]=0x0000001b
164 | [0x00000170]=0x0000001b
165 | [0x000001dc]=0x0000001b
166 | [0x00000048]=0x0000001b
167 | [0x000000b4]=0x0000001b
168 | [0x00000120]=0x0000001b
169 | [0x0000018c]=0x0000001b
170 | [0x000001f8]=0x0000001b
171 | [0x00000064]=0x0000001b
172 | [0x000000d0]=0x0000001b
173 | [0x0000013c]=0x0000001b
174 | [0x000001a8]=0x0000001b
175 | [0x00000014]=0x0000001b
176 | [0x00000080]=0x0000001b
177 | [0x000000f0]=0x0000001c
178 | [0x00000160]=0x0000001c
179 | [0x000001d0]=0x0000001c
180 | [0x00000040]=0x0000001c
181 | [0x000000b0]=0x0000001c
182 | [0x00000120]=0x0000001c
183 | [0x00000190]=0x0000001c
184 | [0x00000000]=0x0000001c
185 | [0x00000070]=0x0000001c
186 | [0x000000e0]=0x0000001c
187 | [0x00000150]=0x0000001c
188 | [0x000001c0]=0x0000001c
189 | [0x00000030]=0x0000001c
190 | [0x000000a0]=0x0000001c
191 | [0x00000110]=0x0000001c
192 | [0x00000180]=0x0000001c
193 | [0x000001f4]=0x0000001d
194 | [0x00000068]=0x0000001d
195 | [0x000000dc]=0x0000001d
196 | [0x00000150]=0x0000001d
197 | [0x000001c4]=0x0000001d
198 | [0x00000038]=0x0000001d
199 | [0x000000ac]=0x0000001d
200 | [0x00000120]=0x0000001d
201 | [0x00000194]=0x0000001d
202 | [0x00000008]=0x0000001d
203 | [0x0000007c]=0x0000001d
204 | [0x000000f0]=0x0000001d
205 | [0x00000164]=0x0000001d
206 | [0x000001d8]=0x0000001d
207 | [0x0000004c]=0x0000001d
208 | [0x000000c0]=0x0000001d
209 | [0x00000138]=0x0000001e
210 | [0x000001b0]=0x0000001e
211 | [0x00000028]=0x0000001e
212 | [0x000000a0]=0x0000001e
213 | [0x00000118]=0x0000001e
214 | [0x00000190]=0x0000001e
215 | [0x00000008]=0x0000001e
216 | [0x00000080]=0x0000001e
217 | [0x000000f8]=0x0000001e
218 | [0x00000170]=0x0000001e
219 | [0x000001e8]=0x0000001e
220 | [0x00000060]=0x0000001e
221 | [0x000000d8]=0x0000001e
222 | [0x00000150]=0x0000001e
223 | [0x000001c8]=0x0000001e
224 | [0x00000040]=0x0000001e
225 | [0x000000bc]=0x0000001f
226 | [0x00000138]=0x0000001f
227 | [0x000001b4]=0x0000001f
228 | [0x00000030]=0x0000001f
229 | [0x000000ac]=0x0000001f
230 | [0x00000128]=0x0000001f
231 | [0x000001a4]=0x0000001f
232 | [0x00000020]=0x0000001f
233 | [0x0000009c]=0x0000001f
234 | [0x00000118]=0x0000001f
235 | [0x00000194]=0x0000001f
236 | [0x00000010]=0x0000001f
237 | [0x0000008c]=0x0000001f
238 | [0x00000108]=0x0000001f
239 | [0x00000184]=0x0000001f
240 | [0x00000000]=0x0000001f
241 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
21 | 32 | This course is the second part of a full year's course on computer system, and in this semester, the course is splited into two parts, 33 | the first part teaches you about the architecture of the computing hardware, and the second part touches the software that runs directly 34 | on top of the hardware, i.e. the operating system. 35 |
36 |38 | Part I: Architecture 39 |
40 |
46 | Part II: Introductory Operating System
47 |
48 | Note: this part is still in preparation, detailed information will be released in the near future, and the course will start from the 8th week.
49 |
| DATE | 67 |COURSE | 68 |NOTE | 69 |
|---|---|---|
| Mar 2 | 72 |Course Introduction MIPS Single-Cycle Processor Implementation |
73 | Assignment 1 Released |
74 |
| Mar 9 | 77 |MIPS Pipeline Processor Implementation | 78 |Assignment 2 Released |
79 |
| Mar 16 | 82 |83 | | 84 | |
| Mar 23 | 87 |88 | | 89 | |
| Mar 30 | 92 |93 | | 94 | |
| Apr 6 | 97 |98 | | Assignment 1 Due Assignment 3 (Part I) Released |
99 |
| Apr 13 | 102 |103 | | 104 | |
| Apr 20 | 107 |108 | | 109 | |
| Apr 27 | 112 |113 | | Assignment 2 Due |
114 |
| May 4 | 117 |118 | | Assignment 3 (Part II) Released |
119 |
| May 11 | 122 |123 | | Assignment 3 (Part I) Due |
124 |
| May 18 | 127 |128 | | 129 | |
| May 25 | 132 |133 | | 134 | |
| Jun 1 | 137 |138 | | Assignment 3 (Part II) Due |
139 |
| 142 | | 143 | | 144 | |
| 147 | | 148 | | 149 | |
| 152 | | 153 | | 154 | |
158 |