Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
118 lines (108 sloc) 3.3 KB
################################################################################
##
## Filename: global.txt
##
## Project: AutoFPGA basic peripheral demonstration project
##
## Purpose: Capture any global configuration parameters
##
## Creator: Dan Gisselquist, Ph.D.
## Gisselquist Technology, LLC
##
################################################################################
##
## Copyright (C) 2017, Gisselquist Technology, LLC
##
## This file is part of the AutoFPGA peripheral demonstration project.
##
## The AutoFPGA peripheral demonstration project is free software (firmware):
## you can redistribute it and/or modify it under the terms of the GNU Lesser
## General Public License as published by the Free Software Foundation, either
## version 3 of the License, or (at your option) any later version.
##
## The AutoFPGA peripheral demonstration project is distributed in the hope
## that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
## warranty of MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License along
## with this program. (It's in the $(ROOT)/doc directory. Run make with no
## target there if the PDF file isn't present.) If not, see
## <http://www.gnu.org/licenses/> for a copy.
##
## License: LGPL, v3, as defined and found on www.gnu.org,
## http://www.gnu.org/licenses/lgpl.html
##
##
################################################################################
##
##
@LEGAL=../auto-data/legalgen.txt
@PROJECT=AutoFPGA basic peripheral demonstration project
#
# @KEYS.TRIMLIST is a list of all string keys that need to be trimmed (have
# spaces removed from either side) before being used
# @KEYS.INTLIST is a list of all things that need to be converted to integers
@KEYS.INTLIST= BUS_ADDRESS_WIDTH NADDR NPIC NSCOPES PIC.MAX REGS.N ID
@DEFAULT.BUS=wb
@REGISTER.BUS=wb
@VERILATOR_PREFIX=v
@SIM.DEFINES=
// Compatibility definitions for Verilator 3.8 to 3.9
#ifndef VVAR
#ifdef NEW_VERILATOR
#define VVAR(A) main__DOT_ ## A
#else
#define VVAR(A) v__DOT_ ## A
#endif
#endif
@SUBD=../auto-generated
@XDC.FILE=../nexysv.xdc
@REGDEFS.H.INSERT=
typedef struct {
unsigned m_addr;
const char *m_name;
} REGNAME;
extern const REGNAME *bregs;
extern const int NREGS;
// #define NREGS (sizeof(bregs)/sizeof(bregs[0]))
extern unsigned addrdecode(const char *v);
extern const char *addrname(const unsigned v);
@REGDEFS.CPP.INCLUDE=
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ctype.h>
@REGDEFS.CPP.INSERT=
#define RAW_NREGS (sizeof(raw_bregs)/sizeof(bregs[0]))
const REGNAME *bregs = raw_bregs;
const int NREGS = RAW_NREGS;
unsigned addrdecode(const char *v) {
if (isalpha(v[0])) {
for(int i=0; i<NREGS; i++)
if (strcasecmp(v, bregs[i].m_name)==0)
return bregs[i].m_addr;
fprintf(stderr, "Unknown register: %s\n", v);
exit(-2);
} else
return strtoul(v, NULL, 0);
}
const char *addrname(const unsigned v) {
for(int i=0; i<NREGS; i++)
if (bregs[i].m_addr == v)
return bregs[i].m_name;
return NULL;
}
@SIM.INCLUDE=
#include "verilated.h"
#include "Vmain.h"
#define BASECLASS Vmain
#include "design.h"
#include "regdefs.h"
#include "testb.h"
@PREFIX=wb
@BUS.NAME=wb
@BUS.TYPE=wb
@$BUS.WIDTH=32
@BUS.CLOCK=clk
@$BUS.NULLSZ=0x400