# GNU Makefile for running my pic 16C6x microcontroller implementation in
# Icarus verilog,

 # Copyright (C) 1999 Stephen G. Tell
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2, or (at your option)
 # any later version.


VPI_MODULE_PATH := /usr/local/lib/ivl
export VPI_MODULE_PATH
VERILOG=/usr/local/bin/verilog

%_run: %.v $(VERILOG)
	$(VERILOG) -o $@ -s $* $*.v

%.log: %_run
	$*_run | tee $@

PICV=alu.v instmem.v iskip.v pic.v regmem.v tpic.v clkgen.v \
	idecode.v ioport.v pcstack.v picram.v statreg.v

tpic_run: $(VERILOG) tpic.v $(PICV) funcs.v
	$(VERILOG) -DICARUS_VERILOG -o $@ -s tpic tpic.v $(PICV)

tpic.pform: $(VERILOG) tpic.v $(PICV) funcs.v
	ivlpp -L -o tpic.pp tpic.v $(PICV)
	ivl -P tpic.pform -s tpic tpic.pp

clean:
	rm -f core *~ *_run
