Add Wishbone datasheets
[AGH_computer_science_engineering_thesis.git] / Makefile.example
blob484c279227263542159f4ec034263a0d4bf1a617
1 # This Makefile is to be included by Makefile of each example
3 ifndef PROJ_DIR
4 PROJ_DIR := ../../
5 endif
7 def : simulate
9 include $(PROJ_DIR)/Makefile.util
11 DESIGN_DIR := $(PROJ_DIR)/design/
12 FONT := $(DESIGN_DIR)/font.mem
14 IVFLAGS += -I$(PROJ_DIR)/include/
16 EMBEDDED_ROM_DEFINES = \
17         -DROM_WORDS_COUNT=$(call FILE_LINES,instructions.mem) \
18         -DEMBEDDED_ROM_FILE=\"instructions.mem\" \
19         -DFONT_FILE=\"$(FONT)\"
21 ifdef FLASH_DATA
22 INCLUDE_SPI_IMAGE = 1
24 # We put some random data in the image so as not to waste time generating
25 # bitstream when we're only working in a simulator.
26 spi.mem : $(PROJ_DIR)/tools/bin2hex $(FLASH_DATA)
27         (dd if=/dev/urandom bs=135100 count=1; cat $(FLASH_DATA)) \
28                 2>/dev/null | $< > $@
29 else
30 FLASH_DATA = /dev/null
31 endif
33 ifdef INCLUDE_SPI_IMAGE
34 SPI_ROM_DEFINES = \
35         -DSPI_ROM_FILE=\"spi.mem\" \
36         -DSPI_ROM_WORDS_COUNT=$(call FILE_LINES,spi.mem)
38 example.vvp : spi.mem
39 simulate : spi.mem
40 endif
42 example.vvp : $(DESIGN_DIR)/*.v soc_with_peripherals.v flash_memory.v sram.v \
43                 vga_display.v example_toplevel.v $(FONT) messages.vh \
44                 instructions.mem
45         $(IV) $(IVFLAGS) $(SIMFLAGS) -DSIMULATION $(EMBEDDED_ROM_DEFINES) \
46                 $(SPI_ROM_DEFINES) -s example $(filter %.v,$^) -o $@
48 simulate : example.vvp
49         $(VVP) $<
50         if [ -f VGAdump.mem ]; then $(MAKE) VGAdump.ppm; fi
52 design.v : instructions.mem $(DESIGN_DIR)/*.v $(FONT)
53         $(IV) $(IVFLAGS) $(EMBEDDED_ROM_DEFINES) -E $(filter %.v,$^) -o $@
55 clean :
56         find . -name "*.vvp" -delete
57         rm $(call FIND_GENERATED_FILES,.) $(addsuffix .log,yosys pnr) \
58                 $(addprefix design.,v json asc bin) spi.mem \
59                 VGAdump.mem VGAdump.ppm 2>/dev/null || true
61 .PHONY : def simulate clean