diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-11-12 23:50:04 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-11-12 23:50:04 +0100 |
commit | fc00f29076aa8171dd238d1d70607ee6abbbba7a (patch) | |
tree | 65c15bc94d9462a786cdc2e859b70107d70e1e7f | |
parent | 4b9292fd45778680447400983bd94041a5a2ea4a (diff) | |
download | SystDigit-Projet-fc00f29076aa8171dd238d1d70607ee6abbbba7a.tar.gz SystDigit-Projet-fc00f29076aa8171dd238d1d70607ee6abbbba7a.zip |
Improvemenet of pow2 (suggested by T.Bourke)
-rw-r--r-- | README | 17 | ||||
-rw-r--r-- | csim/util.c | 5 |
2 files changed, 18 insertions, 4 deletions
@@ -244,3 +244,20 @@ as decimal (this enables the use of whichever representation is preferred). +TODO +---- + +- More advanced commands for the simulator (cf Jonathan's simulator) +- RAM reads give result immediately + +NEXT STEPS +---------- + +- Define convention for processor input/output +- Code UI +- How can we generate netlists with ocaml code ? +- Code processor + + + + diff --git a/csim/util.c b/csim/util.c index a09e959..ef0ae32 100644 --- a/csim/util.c +++ b/csim/util.c @@ -10,10 +10,7 @@ #include "sim.h" int pow2(int exp) { - if (exp == 0) return 1; - if (exp == 1) return 2; - int k = pow2(exp / 2); - return (exp % 2 == 0 ? k * k : 2 * k * k); + return (1 << exp); } t_value read_bool(FILE *stream, t_value *mask) { |