diff options
author | Andrew Waterman <waterman@s141.Millennium.Berkeley.EDU> | 2010-07-18 18:28:05 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@s141.Millennium.Berkeley.EDU> | 2010-07-18 18:28:05 -0700 |
commit | 01c01cc36f006cfb03cd6d1c5a68f926b93f7787 (patch) | |
tree | 1bc5333057ff935073a595834092e4dd0936e34d /riscv/common.h | |
download | riscv-isa-sim-01c01cc36f006cfb03cd6d1c5a68f926b93f7787.zip riscv-isa-sim-01c01cc36f006cfb03cd6d1c5a68f926b93f7787.tar.gz riscv-isa-sim-01c01cc36f006cfb03cd6d1c5a68f926b93f7787.tar.bz2 |
Reorganized directory structure
Moved cross-compiler to /xcc/ rather than /
Added ISA sim in /sim/
Added Proxy Kernel in /pk/ (to be cleaned up)
Added opcode map to /opcodes/ (ditto)
Added documentation to /doc/
Diffstat (limited to 'riscv/common.h')
-rw-r--r-- | riscv/common.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/riscv/common.h b/riscv/common.h new file mode 100644 index 0000000..447d631 --- /dev/null +++ b/riscv/common.h @@ -0,0 +1,23 @@ +#ifndef _RISCV_COMMON_H +#define _RISCV_COMMON_H + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#ifdef __cplusplus +# include <stdexcept> +# define print_and_die(s) throw std::runtime_error(s) +#else +# define print_and_die(s) do { fprintf(stderr,"%s\n",s); abort(); } while(0) +#endif + +#define demand(cond,str,...) \ + do { if(!(cond)) { \ + char __str[256]; \ + snprintf(__str,256,"in %s, line %d: " str, \ + __FILE__,__LINE__,##__VA_ARGS__); \ + print_and_die(__str); \ + } } while(0) + +#endif |