| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -6,7 +6,8 @@ VERILATOR_FLAGS=-O3 -Wno-fatal -Wno-CASEOVERLAP -Wno-UNOPTFLAT #--trace
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# It takes forever to build with optimisation, so disable by default
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#VERILATOR_CFLAGS=-O3
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				GHDLSYNTH ?= ghdl.so
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				# some yosys builds have ghdl plugin built in, otherwise need "-m ghdl"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				GHDLSYNTH ?= $(shell ($(YOSYS) -H | grep -q ghdl) || echo -m ghdl)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				YOSYS     ?= yosys
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				NEXTPNR   ?= nextpnr-ecp5
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				ECPPACK   ?= ecppack
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -35,7 +36,7 @@ PWD = $(shell pwd)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				DOCKERARGS = run --rm -v $(PWD):/src:z -w /src
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				GHDL      = $(DOCKERBIN) $(DOCKERARGS) ghdl/ghdl:buster-llvm-7 ghdl
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				CC        = $(DOCKERBIN) $(DOCKERARGS) ghdl/ghdl:buster-llvm-7 gcc
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				GHDLSYNTH = ghdl
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				GHDLSYNTH = -m ghdl
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				YOSYS     = $(DOCKERBIN) $(DOCKERARGS) hdlc/ghdl:yosys yosys
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				NEXTPNR   = $(DOCKERBIN) $(DOCKERARGS) hdlc/nextpnr:ecp5 nextpnr-ecp5
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				ECPPACK   = $(DOCKERBIN) $(DOCKERARGS) hdlc/prjtrellis ecppack
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -211,10 +212,10 @@ fpga_files = fpga/soc_reset.vhdl \
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				synth_files = $(core_files) $(soc_files) $(fpga_files) $(clkgen) $(toplevel) $(dmi_dtm)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				microwatt.json: $(synth_files) $(RAM_INIT_FILE)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					$(YOSYS) -m $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(synth_files) -e toplevel; read_verilog $(uart_files); synth_ecp5 -abc9 -nowidelut -json $@  $(SYNTH_ECP5_FLAGS)"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					$(YOSYS) $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(synth_files) -e toplevel; read_verilog $(uart_files); synth_ecp5 -abc9 -nowidelut -json $@  $(SYNTH_ECP5_FLAGS)"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				microwatt.v: $(synth_files) $(RAM_INIT_FILE)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					$(YOSYS) -m $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(synth_files) -e toplevel; write_verilog $@"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					$(YOSYS) $(GHDLSYNTH) -p "ghdl --std=08 --no-formal $(GHDL_IMAGE_GENERICS) $(synth_files) -e toplevel; write_verilog $@"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				microwatt-verilator: microwatt.v verilator/microwatt-verilator.cpp verilator/uart-verilator.c
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					$(VERILATOR) $(VERILATOR_FLAGS) -CFLAGS "$(VERILATOR_CFLAGS) -DCLK_FREQUENCY=$(CLK_FREQUENCY)" -Iuart16550 --assert --cc --exe --build $^ -o $@ -top-module toplevel
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |