2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-04 02:14:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								RISCV_GNU_TOOLCHAIN_GIT_REVISION  =  1b80cbe 
						 
					
						
							
								
									
										
										
										
											2016-12-09 18:47:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX  =  /opt/riscv32 
						 
					
						
							
								
									
										
										
										
											2016-04-09 18:29:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-17 07:06:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								SHELL  =  bash 
						 
					
						
							
								
									
										
										
										
											2015-06-27 04:02:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								TEST_OBJS  =  $( addsuffix .o,$( basename $( wildcard tests/*.S) ) )  
						 
					
						
							
								
									
										
										
										
											2015-06-27 05:14:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								FIRMWARE_OBJS  =  firmware/start.o firmware/irq.o firmware/print.o firmware/sieve.o firmware/multest.o firmware/stats.o 
						 
					
						
							
								
									
										
										
										
											2015-07-04 22:31:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								GCC_WARNS   =  -Werror -Wall -Wextra -Wshadow -Wundef -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings 
						 
					
						
							
								
									
										
										
										
											2015-07-04 17:47:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								GCC_WARNS  +=  -Wredundant-decls -Wstrict-prototypes -Wmissing-prototypes -pedantic # -Wconversion  
						 
					
						
							
								
									
										
										
										
											2016-12-09 18:47:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								TOOLCHAIN_PREFIX  =  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) i/bin/riscv32-unknown-elf- 
						 
					
						
							
								
									
										
										
										
											2016-04-09 20:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								COMPRESSED_ISA  =  C 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-15 23:35:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# Add things like "export http_proxy=... https_proxy=..." here
  
						 
					
						
							
								
									
										
										
										
											2017-04-07 17:43:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								GIT_ENV  =  true  
						 
					
						
							
								
									
										
										
										
											2017-03-15 23:35:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 14:57:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test :  testbench .vvp  firmware /firmware .hex  
						 
					
						
							
								
									
										
										
										
											2017-03-15 12:06:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									vvp -N $<
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-12 17:59:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test_vcd :  testbench .vvp  firmware /firmware .hex  
						 
					
						
							
								
									
										
										
										
											2016-08-26 20:54:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									vvp -N $< +vcd +trace +noerror
							 
						 
					
						
							
								
									
										
										
										
											2015-07-02 16:45:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-14 00:45:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test_rvf :  testbench_rvf .vvp  firmware /firmware .hex  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vvp -N $< +vcd +trace +noerror
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-12 04:55:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test_wb :  testbench_wb .vvp  firmware /firmware .hex  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vvp -N $<
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								test_wb_vcd :  testbench_wb .vvp  firmware /firmware .hex  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vvp -N $< +vcd +trace +noerror
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-28 03:36:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test_ez :  testbench_ez .vvp  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vvp -N $<
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								test_ez_vcd :  testbench_ez .vvp  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vvp -N $< +vcd
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 14:57:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								test_sp :  testbench_sp .vvp  firmware /firmware .hex  
						 
					
						
							
								
									
										
										
										
											2017-03-15 12:06:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									vvp -N $<
							 
						 
					
						
							
								
									
										
										
										
											2015-06-27 05:54:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 14:57:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								test_axi :  testbench .vvp  firmware /firmware .hex  
						 
					
						
							
								
									
										
										
										
											2017-03-15 12:06:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									vvp -N $< +axi_test
							 
						 
					
						
							
								
									
										
										
										
											2015-06-07 01:22:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 14:57:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								test_synth :  testbench_synth .vvp  firmware /firmware .hex  
						 
					
						
							
								
									
										
										
										
											2017-03-15 12:06:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									vvp -N $<
							 
						 
					
						
							
								
									
										
										
										
											2015-06-30 07:46:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-25 18:53:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								test_verilator :  testbench_verilator  firmware /firmware .hex  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									./testbench_verilator
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 14:57:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								testbench.vvp :  testbench .v  picorv 32.v  
						 
					
						
							
								
									
										
										
										
											2017-05-28 01:58:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									iverilog -o $@  $( subst C,-DCOMPRESSED_ISA,$( COMPRESSED_ISA) )  $^
							 
						 
					
						
							
								
									
										
										
										
											2017-03-15 12:06:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									chmod -x $@ 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-14 00:45:57 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								testbench_rvf.vvp :  testbench .v  picorv 32.v  rvfimon .v  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									iverilog -o $@  -D RISCV_FORMAL $( subst C,-DCOMPRESSED_ISA,$( COMPRESSED_ISA) )  $^
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									chmod -x $@ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-12 04:55:14 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								testbench_wb.vvp :  testbench_wb .v  picorv 32.v  
						 
					
						
							
								
									
										
										
										
											2017-05-28 01:58:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									iverilog -o $@  $( subst C,-DCOMPRESSED_ISA,$( COMPRESSED_ISA) )  $^
							 
						 
					
						
							
								
									
										
										
										
											2017-03-12 04:55:14 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									chmod -x $@ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-28 03:36:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								testbench_ez.vvp :  testbench_ez .v  picorv 32.v  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									iverilog -o $@  $( subst C,-DCOMPRESSED_ISA,$( COMPRESSED_ISA) )  $^
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									chmod -x $@ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 14:57:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								testbench_sp.vvp :  testbench .v  picorv 32.v  
						 
					
						
							
								
									
										
										
										
											2017-05-28 01:58:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									iverilog -o $@  $( subst C,-DCOMPRESSED_ISA,$( COMPRESSED_ISA) )  -DSP_TEST $^
							 
						 
					
						
							
								
									
										
										
										
											2017-03-15 12:06:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									chmod -x $@ 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-27 05:54:12 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-04 14:57:16 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								testbench_synth.vvp :  testbench .v  synth .v  
						 
					
						
							
								
									
										
										
										
											2017-03-15 12:06:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									iverilog -o $@  -DSYNTH_TEST $^
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									chmod -x $@ 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-30 07:46:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-25 18:53:21 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								testbench_verilator :  testbench .v  picorv 32.v  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									verilator -Wno-lint -Wno-MULTIDRIVEN -trace --top-module picorv32_wrapper --cc testbench.v picorv32.v --exe testbench.cc $( subst C,-DCOMPRESSED_ISA,$( COMPRESSED_ISA) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									$( MAKE)  -C obj_dir -f Vpicorv32_wrapper.mk
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cp obj_dir/Vpicorv32_wrapper testbench_verilator
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-14 00:45:57 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								check :  check -yices  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								check-% :  check .smt 2 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									yosys-smtbmc -s $( subst check-,,$@ )  -t 30  --dump-vcd check.vcd check.smt2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									yosys-smtbmc -s $( subst check-,,$@ )  -t 25  --dump-vcd check.vcd -i check.smt2
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								check.smt2 :  picorv 32.v  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									yosys -v2 -p 'read_verilog -formal picorv32.v'  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									          -p 'prep -top picorv32 -nordff'  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  -p 'assertpmux -noinit; opt -fast'  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										  -p 'write_smt2 -wires check.smt2' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-30 07:46:25 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								synth.v :  picorv 32.v  scripts /yosys /synth_sim .ys  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									yosys -qv3 -l synth.log scripts/yosys/synth_sim.ys
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								firmware/firmware.hex :  firmware /firmware .bin  firmware /makehex .py  
						 
					
						
							
								
									
										
										
										
											2015-07-16 17:10:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									python3 firmware/makehex.py $< 16384  > $@ 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								firmware/firmware.bin :  firmware /firmware .elf  
						 
					
						
							
								
									
										
										
										
											2015-07-04 17:47:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									$( TOOLCHAIN_PREFIX) objcopy -O binary $< $@ 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									chmod -x $@ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-27 04:02:22 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								firmware/firmware.elf :  $( FIRMWARE_OBJS )  $( TEST_OBJS )  firmware /sections .lds  
						 
					
						
							
								
									
										
										
										
											2016-12-17 20:00:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$( TOOLCHAIN_PREFIX) gcc -Os -ffreestanding -nostdlib -o $@  \
 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										-Wl,-Bstatic,-T,firmware/sections.lds,-Map,firmware/firmware.map,--strip-debug \
 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-27 04:02:22 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										$( FIRMWARE_OBJS)  $( TEST_OBJS)  -lgcc
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									chmod -x $@ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-25 20:08:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								firmware/start.o :  firmware /start .S  
						 
					
						
							
								
									
										
										
										
											2016-12-17 20:00:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									$( TOOLCHAIN_PREFIX) gcc -c -march= rv32im$( subst C,c,$( COMPRESSED_ISA) )  -o $@  $<
							 
						 
					
						
							
								
									
										
										
										
											2015-06-25 20:08:39 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-27 04:02:22 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								firmware/%.o :  firmware /%.c  
						 
					
						
							
								
									
										
										
										
											2016-12-17 20:00:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									$( TOOLCHAIN_PREFIX) gcc -c -march= rv32i$( subst C,c,$( COMPRESSED_ISA) )  -Os --std= c99 $( GCC_WARNS)  -ffreestanding -nostdlib -o $@  $<
							 
						 
					
						
							
								
									
										
										
										
											2015-06-27 04:02:22 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								tests/%.o :  tests /%.S  tests /riscv_test .h  tests /test_macros .h  
						 
					
						
							
								
									
										
										
										
											2016-12-17 20:00:30 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									$( TOOLCHAIN_PREFIX) gcc -c -march= rv32im -o $@  -DTEST_FUNC_NAME= $( notdir $( basename $<) )  \
 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										-DTEST_FUNC_TXT= '"$(notdir $(basename $<))"'  -DTEST_FUNC_RET= $( notdir $( basename $<) ) _ret $<
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-09 18:29:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								download-tools :  
						 
					
						
							
								
									
										
										
										
											2017-03-15 23:35:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									sudo bash -c ' set  -ex;  mkdir -p /var/cache/distfiles;  $( GIT_ENV) ;  \
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 21:09:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									$( foreach REPO,riscv-gnu-toolchain riscv-binutils-gdb riscv-dejagnu riscv-gcc riscv-glibc riscv-newlib, \
 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-17 07:06:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										if  ! test  -d /var/cache/distfiles/$( REPO) .git;  then  rm -rf /var/cache/distfiles/$( REPO) .git.part;  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											git clone --bare https://github.com/riscv/$( REPO)  /var/cache/distfiles/$( REPO) .git.part;  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											mv /var/cache/distfiles/$( REPO) .git.part /var/cache/distfiles/$( REPO) .git;  else  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											( cd  /var/cache/distfiles/$( REPO) .git;  git fetch https://github.com/riscv/$( REPO) ) ;  fi ; ) ' 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-09 18:29:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								d e f i n e  b u i l d _ t o o l s _ t e m p l a t e  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								build-$(1)-tools :  
						 
					
						
							
								
									
										
										
										
											2016-12-09 18:47:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									@read -p " This will remove all existing data from  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) $( subst riscv32,,$( 1) ) . Type YES to continue:  "  reply &&  [ [  " $$ $$ reply "  = =  [ Yy] [ Ee] [ Ss]  ||  " $$ $$ reply "  = =  [ Yy]  ] ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sudo bash -c " set -ex; rm -rf  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) $( subst riscv32,,$( 1) ) ; mkdir -p  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) $( subst riscv32,,$( 1) ) ; chown  $$ $$ {USER}.  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) $( subst riscv32,,$( 1) ) " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									+$( MAKE)  build-$( 1) -tools-bh
							 
						 
					
						
							
								
									
										
										
										
											2016-04-11 18:46:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								build-$(1)-tools-bh :  
						 
					
						
							
								
									
										
										
										
											2017-03-15 23:35:02 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									+set -ex;  $( GIT_ENV) ;  \
 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-17 07:06:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									if  [  -d /var/cache/distfiles/riscv-gnu-toolchain.git ] ;  then  reference_riscv_gnu_toolchain = "--reference /var/cache/distfiles/riscv-gnu-toolchain.git" ;  else  reference_riscv_gnu_toolchain = "" ;  fi ;  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  [  -d /var/cache/distfiles/riscv-binutils-gdb.git ] ;  then  reference_riscv_binutils_gdb = "--reference /var/cache/distfiles/riscv-binutils-gdb.git" ;  else  reference_riscv_binutils_gdb = "" ;  fi ;  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  [  -d /var/cache/distfiles/riscv-dejagnu.git ] ;  then  reference_riscv_dejagnu = "--reference /var/cache/distfiles/riscv-dejagnu.git" ;  else  reference_riscv_dejagnu = "" ;  fi ;  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  [  -d /var/cache/distfiles/riscv-gcc.git ] ;  then  reference_riscv_gcc = "--reference /var/cache/distfiles/riscv-gcc.git" ;  else  reference_riscv_gcc = "" ;  fi ;  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  [  -d /var/cache/distfiles/riscv-glibc.git ] ;  then  reference_riscv_glibc = "--reference /var/cache/distfiles/riscv-glibc.git" ;  else  reference_riscv_glibc = "" ;  fi ;  \
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 21:09:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									if  [  -d /var/cache/distfiles/riscv-newlib.git ] ;  then  reference_riscv_newlib = "--reference /var/cache/distfiles/riscv-newlib.git" ;  else  reference_riscv_newlib = "" ;  fi ;  \
 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-17 07:06:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									rm -rf riscv-gnu-toolchain-$( 1) ;  git clone $$ $$ reference_riscv_gnu_toolchain https://github.com/riscv/riscv-gnu-toolchain riscv-gnu-toolchain-$( 1) ;  \
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-09 18:47:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									cd  riscv-gnu-toolchain-$( 1) ;  git checkout $( RISCV_GNU_TOOLCHAIN_GIT_REVISION) ;  \
 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-17 07:06:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									git submodule update --init $$ $$ reference_riscv_binutils_gdb riscv-binutils-gdb;  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									git submodule update --init $$ $$ reference_riscv_dejagnu riscv-dejagnu;  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									git submodule update --init $$ $$ reference_riscv_gcc riscv-gcc;  \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									git submodule update --init $$ $$ reference_riscv_glibc riscv-glibc;  \
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-08 21:09:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									git submodule update --init $$ $$ reference_riscv_newlib riscv-newlib;  \
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-09 18:47:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									mkdir build;  cd  build;  ../configure --with-arch= $( 2)  --prefix= $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) $( subst riscv32,,$( 1) ) ;  make
							 
						 
					
						
							
								
									
										
										
										
											2016-04-09 18:29:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								.PHONY :  build -$( 1) -tools  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								e n d e f  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 21:43:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$( eval  $ ( call  build_tools_template ,riscv 32i ,rv 32i ) )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$( eval  $ ( call  build_tools_template ,riscv 32ic ,rv 32ic ) )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$( eval  $ ( call  build_tools_template ,riscv 32im ,rv 32im ) )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$( eval  $ ( call  build_tools_template ,riscv 32imc ,rv 32imc ) )  
						 
					
						
							
								
									
										
										
										
											2016-04-09 18:29:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-11 18:46:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								build-tools :  
						 
					
						
							
								
									
										
										
										
											2016-12-09 18:47:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									@echo " This will remove all existing data from  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) i,  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) ic,  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) im, and  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) imc. " 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-11 18:46:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									@read -p "Type YES to continue: "  reply &&  [ [  " $$ reply "  = =  [ Yy] [ Ee] [ Ss]  ||  " $$ reply "  = =  [ Yy]  ] ] 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-09 18:47:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									sudo bash -c " set -ex; rm -rf  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) {i,ic,im,imc}; mkdir -p  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) {i,ic,im,imc}; chown  $$ {USER}.  $( RISCV_GNU_TOOLCHAIN_INSTALL_PREFIX) {i,ic,im,imc} " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									+$( MAKE)  build-riscv32i-tools-bh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									+$( MAKE)  build-riscv32ic-tools-bh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									+$( MAKE)  build-riscv32im-tools-bh
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									+$( MAKE)  build-riscv32imc-tools-bh
							 
						 
					
						
							
								
									
										
										
										
											2016-04-11 18:46:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-30 18:25:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								toc :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									gawk '/^-+$$/ { y=tolower(x); gsub("[^a-z0-9]+", "-", y); gsub("-$$", "", y); printf("- [%s](#%s)\n", x, y); } { x=$$0; }'  README.md
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								clean :  
						 
					
						
							
								
									
										
										
										
											2016-04-09 18:51:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									rm -rf riscv-gnu-toolchain-riscv32i riscv-gnu-toolchain-riscv32ic \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										riscv-gnu-toolchain-riscv32im riscv-gnu-toolchain-riscv32imc
							 
						 
					
						
							
								
									
										
										
										
											2015-10-15 05:26:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									rm -vrf $( FIRMWARE_OBJS)  $( TEST_OBJS)  check.smt2 check.vcd synth.v synth.log \
 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-02 17:01:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										firmware/firmware.elf firmware/firmware.bin firmware/firmware.hex firmware/firmware.map \
 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-28 03:36:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										testbench.vvp testbench_sp.vvp testbench_synth.vvp testbench_ez.vvp \
 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-14 00:45:57 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										testbench_rvf.vvp testbench_wb.vvp testbench.vcd testbench.trace
							 
						 
					
						
							
								
									
										
										
										
											2015-06-06 20:01:37 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-28 03:36:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								.PHONY :  test  test_vcd  test_sp  test_axi  test_wb  test_wb_vcd  test_ez  test_ez_vcd  test_synth  download -tools  build -tools  toc  clean