head	1.4;
access;
symbols;
locks; strict;
comment	@# @;


1.4
date	2008.06.26.18.01.17;	author jamey.hicks;	state Exp;
branches;
next	1.3;
commitid	40054863d96c4567;

1.3
date	2008.06.26.18.00.41;	author jamey.hicks;	state Exp;
branches;
next	1.2;
commitid	3f514863d9484567;

1.2
date	2008.06.26.18.00.17;	author jamey.hicks;	state Exp;
branches;
next	1.1;
commitid	3ecf4863d92f4567;

1.1
date	2008.06.26.18.00.05;	author jamey.hicks;	state Exp;
branches;
next	;
commitid	3e854863d9234567;


desc
@@


1.4
log
@new


git-svn-id: svn+ssh://csg.csail.mit.edu/afs/csail.mit.edu/group/csg/svnroots/blue-projects/trunk/h264@@1354 9e70a9ba-87e6-0310-8a3d-bda4c4b0334c


Author: kfleming <kfleming@@9e70a9ba-87e6-0310-8a3d-bda4c4b0334c>
@
text
@#=======================================================================
# 6.375 Makefile for vcs-sim-rtl
#-----------------------------------------------------------------------
# $Id: Makefile,v 1.3 2008/06/26 18:00:41 jamey.hicks Exp $
#
# This makefile will build a rtl simulator and run various tests to
# verify proper functionality.
#

default : all

basedir  = ../

#--------------------------------------------------------------------
# Sources
#--------------------------------------------------------------------

# TSL library sources
tsllibs = $(MIT6375_HOME)/libs/tsl180/tsl18fs120/verilog/

# Verilog sources
testsrcdir = $(basedir)/build/
bsrcdir = $(basedir)/dc/current
verilogsrc = $(basedir)/src_verilog

vsrcs = \
	$(pardir)/par.v \
	$(testsrcdir)/mkTH.v \
	$(verilogsrc)/top.v \
#	$(bsrcdir)/mkbSVector.v \
#	$(bsrcdir)/mkBufferControl.v \
#	$(bsrcdir)/mkCalc_nC.v \
#	$(bsrcdir)/mkDeblockFilter.v \
#	$(bsrcdir)/mkEntropyDec.v \
#	$(bsrcdir)/mkH264.v \
#	$(bsrcdir)/mkInterpolator.v \
#	$(bsrcdir)/mkInverseTrans.v \
#	$(bsrcdir)/mkLeftVector.v \
#	$(bsrcdir)/mkPrediction.v \
#	$(bsrcdir)/mkTH.v \
#	$(bsrcdir)/mkTopVector.v \
#	$(bsrcdir)/mkWorkVectorHor.v \
#	$(bsrcdir)/mkWorkVectorVer.v \
#	$(bsrcdir)/module_cavlc_coeff_token.v \
#	$(bsrcdir)/module_cavlc_level_prefix.v \
#	$(bsrcdir)/module_cavlc_run_before.v \
#	$(bsrcdir)/module_cavlc_total_zeros.v \
#	$(bsrcdir)/module_expgolomb_coded_block_pattern.vmodule_expgolomb_codenum32.v \
#	$(bsrcdir)/module_expgolomb_codenum.v \
#	$(bsrcdir)/module_expgolomb_numbits32.v \
#	$(bsrcdir)/module_expgolomb_numbits.v \
#	$(bsrcdir)/module_expgolomb_signed32.v \
#	$(bsrcdir)/module_expgolomb_signed.v \
#	$(bsrcdir)/module_expgolomb_unsigned32.v \
#	$(bsrcdir)/module_expgolomb_unsigned.v \



#Myron told me to add you
vclibdir  = $(MIT6375_HOME)/install/bsvclib
vclibsrcs = \
	$(vclibdir)/mkEHRReg4.v \
	$(vclibdir)/mkResetRegFileFull_h.v \
	$(tsllibs)/mtb_verilog.v \

bsclibdir = $(BLUESPECDIR)/Verilog
bsclibsrcs = \
	$(bsclibdir)/FIFO2.v \
	$(bsclibdir)/RegFile.v \
	$(bsclibdir)/RegFileLoad.v \

testscriptsdir = $(basedir)/test
testfilesdir = $(basedir)/test/h264
testfiles = \
	$(testfilesdir)/x264foreman_qcif1-5.264 \

pardir = $(basedir)/enc-par/current



#--------------------------------------------------------------------
# Build rules
#--------------------------------------------------------------------

VCS      = vcs
VCS_OPTS = -notice -PP -line +lint=all +v2k -timescale=1ns/10ps 




# Task for setting up the test case
define setup-test
	cp $(1) input.264
	cp $(1) input.hex # This line is dirty, but it will avoid the problem of not having hex files. 
	rm *.hex
        perl $(testscriptsdir)/hexfilegen.pl input.264
	wc input.264 | awk '{printf("%08x\n%08x\n%08x\n%08x\n", $$3, $$3, $$3, $$3)}' > input_size.hex
endef

#------------------------------------------------------------
# Build the processor simulator

vcs_sim = simv

par-sdf:
	cp $(pardir)/postroute.sdf ./top.sdf

$(vcs_sim) : $(vsrcs) par-sdf
	$(VCS) $(VCS_OPTS) +incdir+$(tsllibs) -o $(vcs_sim) +csdf+precompile +sdfverbose\
		  +libext+.v -y $(tsllibs) \
	       +incdir+$(vclibdir) $(addprefix -v ,$(vclibsrcs)) +incdir+$(bsclibdir) $(addprefix -v ,$(bsclibsrcs)) $(vsrcs)

sim-rtl : $(vcs_sim)

foreman : sim-rtl
	$(call setup-test, $(testfilesdir)/x264foreman_qcif1-5.264) 

junk += simv* csrc *.vpd vcs.key

#--------------------------------------------------------------------
# Default make target
#--------------------------------------------------------------------

all : foreman

#--------------------------------------------------------------------
# Clean up
#--------------------------------------------------------------------

clean :
	rm -rf $(objs) $(junk) *~ \#* *.log *.cmd *.daidir *.sdf *.hex *.v *.264 *.sdf_c *.vcd
@


1.3
log
@Fixes to make file


git-svn-id: svn+ssh://csg.csail.mit.edu/afs/csail.mit.edu/group/csg/svnroots/blue-projects/trunk/h264@@1350 9e70a9ba-87e6-0310-8a3d-bda4c4b0334c


Author: kfleming <kfleming@@9e70a9ba-87e6-0310-8a3d-bda4c4b0334c>
@
text
@d4 1
a4 1
# $Id: Makefile,v 1.2 2008/06/26 18:00:17 jamey.hicks Exp $
d27 1
a27 1
	$(bsrcdir)/synthesized.v \
@


1.2
log
@Added commands to make file to support sdf files


git-svn-id: svn+ssh://csg.csail.mit.edu/afs/csail.mit.edu/group/csg/svnroots/blue-projects/trunk/h264@@1346 9e70a9ba-87e6-0310-8a3d-bda4c4b0334c


Author: kfleming <kfleming@@9e70a9ba-87e6-0310-8a3d-bda4c4b0334c>
@
text
@d4 1
a4 1
# $Id: Makefile,v 1.1 2008/06/26 18:00:05 jamey.hicks Exp $
d106 1
a106 1
	cp $(pardir)/postroute.sdf ./
d108 3
a110 3
$(vcs_sim) : $(vsrcs), par-sdf
	$(VCS) $(VCS_OPTS) +incdir+$(tsllibs) -o $(vcs_sim) +csdf+precompile\
		   +libext+.v -y $(tsllibs) \
d124 1
a124 1
all : $(vcs_sim)
d131 1
a131 1
	rm -rf $(objs) $(junk) *~ \#* *.log *.cmd *.daidir
@


1.1
log
@Adding vcs


git-svn-id: svn+ssh://csg.csail.mit.edu/afs/csail.mit.edu/group/csg/svnroots/blue-projects/trunk/h264@@1344 9e70a9ba-87e6-0310-8a3d-bda4c4b0334c


Author: kfleming <kfleming@@9e70a9ba-87e6-0310-8a3d-bda4c4b0334c>
@
text
@d4 1
a4 1
# $Id: Makefile,v 1.2 2007/03/28 17:20:55 kfleming Exp $
d12 1
a12 1
basedir  = ../..
d18 3
d22 3
a24 2
vsrcdir = $(basedir)/src
bsrcdir = $(basedir)/build/bsc-compile
d27 30
a56 73
	$(bsrcdir)/mkCoreTH.v \
	$(bsrcdir)/mkCore.v \
	$(bsrcdir)/mkDataCacheBlocking.v \
	$(bsrcdir)/mkInstCacheBlocking.v \
	$(bsrcdir)/mkMainMem_latency1.v \
	$(bsrcdir)/mkMemArb.v \
	$(bsrcdir)/mkProc.v \
	$(vsrcdir)/mkCoreTH_wrapper.v \

# Globally installed assembly tests

global_tstdir = $(MIT6375_HOME)/install/smips-tests
global_asm_tests = \
	smipsv1_simple.S \
	smipsv1_addiu.S \
	smipsv1_bne.S \
	smipsv1_lw.S \
	smipsv1_sw.S \
	smipsv2_addiu.S \
	smipsv2_addu.S \
	smipsv2_andi.S \
	smipsv2_and.S \
	smipsv2_beq.S \
	smipsv2_bgez.S \
	smipsv2_bgtz.S \
	smipsv2_blez.S \
	smipsv2_bltz.S \
	smipsv2_bne.S \
	smipsv2_jalr.S \
	smipsv2_jal.S \
	smipsv2_jr.S \
	smipsv2_j.S \
	smipsv2_lui.S \
	smipsv2_lw.S \
	smipsv2_nor.S \
	smipsv2_ori.S \
	smipsv2_or.S \
	smipsv2_simple.S \
	smipsv2_sll.S \
	smipsv2_sllv.S \
	smipsv2_slti.S \
	smipsv2_sltiu.S \
	smipsv2_slt.S \
	smipsv2_sltu.S \
	smipsv2_sra.S \
	smipsv2_srav.S \
	smipsv2_srl.S \
	smipsv2_srlv.S \
	smipsv2_subu.S \
	smipsv2_sw.S \
	smipsv2_xori.S \
	smipsv2_xor.S \

# Local assembly tests

local_tstdir = $(basedir)/tests
local_asm_tests = \
#	hazard.S\

# Globally installed benchmarks

global_bmarkdir = $(MIT6375_HOME)/install/smips-bmarks
global_bmarks = \
	median \
	qsort \
	towers \
	vvadd \

# Locally installed benchmarks

local_bmarkdir = $(basedir)/bmarks
local_bmarks = \
	multiply \
d62 18
a79 2
        $(vclibdir)/mkEHRReg4.v \
        $(vclibdir)/mkResetRegFileFull_h.v \
a84 3
HOST_OPTS = -DPREALLOCATE=0 -DHOST_DEBUG=1 
HOST_COMP = gcc $(HOST_OPTS)

a87 19
SMIPS_TESTBUILD = smips-testbuild -smips -opti O2
SMIPS_OBJDUMP = smips-objdump --disassemble-all --disassemble-zeroes
SMIPS_OBJDUMP_TO_VMH = objdump2vmh.pl 

SMIPS_GCC      = smips-gcc
SMIPS_GCC_OPTS = -O2 -G 0 -nostdlib -nostartfiles

bmarks = $(global_bmarks) $(local_bmarks)

VPATH += $(addprefix $(global_bmarkdir)/, $(global_bmarks)) \
         $(addprefix $(local_bmarkdir)/, $(local_bmarks))

incs  += -I. $(addprefix -I$(global_bmarkdir)/, $(global_bmarks)) \
             $(addprefix -I$(local_bmarkdir)/, $(local_bmarks))
objs  :=

smips_gcc_dir    = $(MIT6375_HOME)/tools/smips-gcc/current
smips_gcc_libdir = $(smips_gcc_dir)/lib
smips_gcc_incdir = $(Smips_gcc_inc)/inc
a88 3
SMIPS_LINK = smips-ld $(smips_gcc_libdir)/crt1.o \
                      -T$(smips_gcc_libdir)/testraw.ld \
                      -L. -L$(smips_gcc_libdir)
a89 3
ifneq ($(strip $(global_bmarks)),)
include $(patsubst %, $(global_bmarkdir)/%/bmark.mk, $(global_bmarks))
endif
d91 8
a98 3
ifneq ($(strip $(local_bmarks)),)
include $(patsubst %, $(local_bmarkdir)/%/bmark.mk, $(local_bmarks))
endif
a103 4
$(vcs_sim) : $(vsrcs)
	$(VCS) $(VCS_OPTS) +incdir+$(srcdir) -o $(vcs_sim) \
		   +libext+.v -y $(BLUESPECDIR)/Verilog \
	       +incdir+$(vclibdir) $(addprefix -v ,$(vclibsrcs)) $(vsrcs)
d105 2
a106 1
sim-rtl : $(vcs_sim)
d108 4
a111 1
junk += simv* csrc *.vpd vcs.key
d113 1
a113 2
#------------------------------------------------------------
# Build and run assembly tests
d115 2
a116 1
asm_tests = $(global_asm_tests) $(local_asm_tests)
d118 1
a118 78
global_asm_tests_bin = $(addsuffix .smips.bin, $(patsubst %.S, %, $(global_asm_tests)))
local_asm_tests_bin  = $(addsuffix .smips.bin, $(patsubst %.S, %, $(local_asm_tests)))

asm_tests_vmh  = $(addsuffix .smips.vmh,  $(patsubst %.S, %,$(asm_tests)))
asm_tests_dump = $(addsuffix .smips.dump, $(patsubst %.S, %,$(asm_tests)))
asm_tests_out  = $(addsuffix .smips.out,  $(patsubst %.S, %,$(asm_tests)))

$(global_asm_tests_bin): %.smips.bin : $(global_tstdir)/%.S
	$(SMIPS_TESTBUILD) $< -o $@@

$(local_asm_tests_bin): %.smips.bin : $(local_tstdir)/%.S
	$(SMIPS_TESTBUILD) $< -o $@@

$(asm_tests_dump) : %.smips.dump : %.smips.bin
	$(SMIPS_OBJDUMP) $< > $@@

$(asm_tests_vmh) : %.smips.vmh : %.smips.dump
	$(SMIPS_OBJDUMP_TO_VMH) $< $@@

$(asm_tests_out) : %.smips.out : %.smips.vmh $(vcs_sim) 
	./$(vcs_sim) +exe=$< > $@@

run-asm-tests : $(asm_tests_out)
	@@echo; perl -ne 'print "  [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
	       $(asm_tests_out); echo;

junk += $(global_asm_tests_bin) $(local_asm_tests_bin) \
        $(asm_tests_vmh) $(asm_tests_out) $(asm_tests_dump)

#------------------------------------------------------------
# Build and run benchmarks on smips simulator

bmarks_smips_bin  = $(addsuffix .smips.bin,  $(bmarks))
bmarks_smips_dump = $(addsuffix .smips.dump, $(bmarks))
bmarks_smips_vmh  = $(addsuffix .smips.vmh,  $(bmarks))
bmarks_smips_out  = $(addsuffix .smips.out,  $(bmarks))

bmarks_defs   = -DPREALLOCATE=1 -DHOST_DEBUG=0
bmarks_cycles = 800000

%.o : %.c
	$(SMIPS_GCC) $(SMIPS_GCC_OPTS) $(bmarks_defs) \
	             -c -I$(smips_gcc_incdir) $(incs) $< -o $@@

%.o : %.S
	$(SMIPS_GCC) $(SMIPS_GCC_OPTS) $(bmarks_defs) \
	             -c -I$(smips_gcc_incdir) $(incs) $< -o $@@

$(bmarks_smips_dump) : %.smips.dump : %.smips.bin
	$(SMIPS_OBJDUMP) $< > $@@

$(bmarks_smips_vmh) : %.smips.vmh : %.smips.dump
	$(SMIPS_OBJDUMP_TO_VMH) $< $@@

$(bmarks_smips_out) : %.smips.out : %.smips.vmh $(vcs_sim) 
	./$(vcs_sim) +max-cycles=$(bmarks_cycles) +exe=$< > $@@

run-bmarks-smips : $(bmarks_smips_out)
	echo; perl -ne 'print "  [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
	       $(bmarks_smips_out); echo;

junk += $(bmarks_smips_bin) $(bmarks_smips_vmh) \
        $(bmarks_smips_out) $(bmarks_smips_dump)

#------------------------------------------------------------
# Build and run benchmarks on host machine

bmarks_host_bin = $(addsuffix .host.bin, $(bmarks))
bmarks_host_out = $(addsuffix .host.out, $(bmarks))

$(bmarks_host_out) : %.host.out : %.host.bin
	./$< > $@@

run-bmarks-host : $(bmarks_host_out)
	echo; perl -ne 'print "  [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
	       $(bmarks_host_out); echo;

junk += $(bmarks_host_bin) $(bmarks_host_out)
@

