initial
[fpgammix.git] / workloads / common / Rules.mk
blobbcabf6c68ab96734548e1becd9914d8a4b80ff0b
1 FPGAMMIX_DIR=/home/tommy/fpgammix
2 MMIX_TOOLS_BIN=/opt/mmix/bin
4 # XXX -mno-base-addresses should be the default! -mbase-addresses is
5 # completely unscalable, running out of globals within 30 uses.
7 #CFLAGS=-mno-base-addresses -O2 -fomit-frame-pointer
8 MMIXCC=$(MMIX_TOOLS_BIN)/mmix-gcc
9 CFLAGS=-O -fomit-frame-pointer -std=gnu99
10 LDOPTS=
11 #LDOPTS=-Ttext=80000000
12 T=1
14 # Four ways to run %:
15 # - via the mmix userlevel simuator: %.mmixsim
16 # - via the mmmix pipeline simuator: %.mmmixsim
17 # - via the RTL implementation: %.rtlsim
18 # - uploaded to tinymon on FPGA: %.txt + manual upload (for now)
20 # In future possible pushed via z-modem or even UDP broadcasts
22 %.mmixsim: %.mmo
23 mmix -l -t$(T) $<
25 %.mmmixsim: %.mmb
26 (echo v1;echo @8000000000005000;echo 999999) | mmmix ../common/plain.mmconfig $<
28 %.rtlsim: %.txt $(FPGAMMIX_DIR)/rtl/Icarus/initmem.data
29 cp $< $(FPGAMMIX_DIR)/rtl/Icarus/input.txt
30 $(MAKE) -C $(FPGAMMIX_DIR)/rtl/Icarus;
32 ####
34 %.mmo: %.mms
35 mmixal -l $@.lst -o $@ $<
37 %.mmo: %.elf
38 $(MMIX_TOOLS_BIN)/mmix-objcopy -I elf64-mmix -O mmo $< $@
40 %.mmb: %.mmo
41 mmix -D$@ $<
43 %.txt: %.elf
44 $(MMIX_TOOLS_BIN)/mmix-strip $< -o $<.stripped
45 $(MMIX_TOOLS_BIN)/mmix-objdump -s $<.stripped|cut -d' ' -f-6 > $@
46 $(MMIX_TOOLS_BIN)/mmix-nm $< |grep 'T Main'|(read x y;echo " $$x"G) >> $@
48 # The default .elf rule only applies to the most trivial of examples
49 # XXX To improve in future
50 %.elf: %.o
51 $(MMIXCC) $(CFLAGS) -Ttext=800 -melf $< -o $@
52 $(MMIX_TOOLS_BIN)/mmix-objdump -d $@
54 %.o: %.c Makefile
55 $(MMIXCC) $(CFLAGS) -c $< -o $@
57 %.o: %.s Makefile
58 $(MMIXCC) $(CFLAGS) -c $< -o $@
60 %.o: %.S Makefile
61 $(MMIXCC) $(CFLAGS) -c $< -o $@
63 %.o: %.mmo
64 $(MMIX_TOOLS_BIN)/mmix-objcopy -I mmo -O elf64-mmix $< $@
66 %.data: %.elf
67 $(MMIX_TOOLS_BIN)/mmix-objdump -s $< | grep '^ '|cut -d' ' -f3-6|tr ' ' '\n' | grep -v '^$$' > $@
69 %.dis: %.elf
70 $(MMIX_TOOLS_BIN)/mmix-objdump -d $<
72 clean:
73 -rm *.elf *.elf.stripped *.o *.txt *.mmo *.mmb *.data *.dis