URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 560 to Rev 561
- ↔ Reverse comparison
Rev 560 → Rev 561
/openrisc/trunk/or1ksim/cpu/or1k/spr-defs.h
586,7 → 586,7
* Bit definitions for Tick Timer Control Register |
* |
*/ |
#define SPR_TTCR_CNT 0x0fffffff /* Count, time period */ |
#define SPR_TTCR_CNT 0xffffffff /* Count, time period */ |
#define SPR_TTMR_TP 0x0fffffff /* Time period */ |
#define SPR_TTMR_IP 0x10000000 /* Interrupt Pending */ |
#define SPR_TTMR_IE 0x20000000 /* Interrupt Enable */ |
/openrisc/trunk/or1ksim/doc/version.texi
1,4 → 1,4
@set UPDATED 6 June 2011 |
@set UPDATED 10 June 2011 |
@set UPDATED-MONTH June 2011 |
@set EDITION 2011-04-28 |
@set VERSION 2011-04-28 |
/openrisc/trunk/or1ksim/ChangeLog
1,3 → 1,20
2011-06-12 Julius Baxter <julius@opencores.org> |
|
* cpu/or1k/spr-defs.h: <SPR_TTCR_CNT>: Change back to 0xffffffff |
* tick/tick.c: <cycles_start>: renamed cycle_count_at_tick_start. |
<tick_count>: Renamed tick_counting. |
(sched_timer_job): Various comments to detail what is going on. |
<match_time>: Renamed match_ttmr. |
<ttcr_period>: Renamed match_ttcr. |
<match_ttcr>: Is now TTCR value masked with TTMR_TP. |
<cycles_until_except>: Added, being used to calculate cycles until next |
exception instead of match_time. |
|
|
2011-06-10 Julius Baxter <julius@opencores.org> |
|
* cpu/or1k/spr-defs.h: <SPR_TTCR_CNT>: Change to 0x0fffffff |
|
2011-06-06 Julius Baxter <julius@opencores.org> |
|
* Makefile.in: Regenerated. |
/openrisc/trunk/or1ksim/configure
1,5 → 1,5
#! /bin/sh |
# From configure.ac Id: configure.ac 552 2011-06-05 10:49:58Z julius using automake version AC_ACVERSION. |
# From configure.ac Id: configure.ac 556 2011-06-06 19:17:37Z julius using automake version AC_ACVERSION. |
# Guess values for system-dependent variables and create Makefiles. |
# Generated by GNU Autoconf 2.64 for or1ksim 2011-04-28. |
# |
/openrisc/trunk/or1ksim/tick/tick.c
49,11 → 49,11
|
|
/*! When did the timer start to count */ |
static long long cycles_start = 0; |
static long long cycle_count_at_tick_start = 0; |
|
/*! Indicates if the timer is actually counting. Needed to simulate one-shot |
mode correctly */ |
int tick_count; |
int tick_counting; |
|
/*! Reset. It initializes TTCR register. */ |
void |
66,7 → 66,7
|
cpu_state.sprs[SPR_TTCR] = 0; |
cpu_state.sprs[SPR_TTMR] = 0; |
tick_count = 0; |
tick_counting = 0; |
} |
|
/*! Raises a timer exception */ |
91,7 → 91,7
tick_restart (void *dat) |
{ |
cpu_state.sprs[SPR_TTCR] = 0; |
cycles_start = runtime.sim.cycles; |
cycle_count_at_tick_start = runtime.sim.cycles; |
SCHED_ADD (tick_restart, NULL, cpu_state.sprs[SPR_TTMR] & SPR_TTMR_TP); |
} |
|
100,7 → 100,7
tick_one_shot (void *dat) |
{ |
cpu_state.sprs[SPR_TTCR] = cpu_state.sprs[SPR_TTMR] & SPR_TTMR_TP; |
tick_count = 0; |
tick_counting = 0; |
} |
|
/*! Schedules the timer jobs */ |
108,10 → 108,13
sched_timer_job (uorreg_t prev_ttmr) |
{ |
uorreg_t ttmr = cpu_state.sprs[SPR_TTMR]; |
uint32_t match_time = ttmr & SPR_TTMR_TP; |
uint32_t ttcr_period = spr_read_ttcr () & SPR_TTCR_CNT; |
uint32_t match_ttmr = ttmr & SPR_TTMR_TP; |
/* TTCR register, only concerned with part of TTCR which will trigger int */ |
uint32_t match_ttcr = spr_read_ttcr () & SPR_TTMR_TP; |
uint32_t cycles_until_except; |
|
/* Remove previous jobs if they exists */ |
/* On clearing TTMR interrupt signal bit remove previous jobs if they |
exist */ |
if ((prev_ttmr & SPR_TTMR_IE) && !(ttmr & SPR_TTMR_IP)) |
{ |
SCHED_FIND_REMOVE (tick_raise_except, NULL); |
128,40 → 131,43
break; |
} |
|
if (match_time >= ttcr_period) |
/* Calculate cycles until next tick exception, based on current TTCR value */ |
if (match_ttmr >= match_ttcr) |
{ |
match_time -= ttcr_period; |
cycles_until_except = match_ttmr - match_ttcr; |
} |
else |
{ |
match_time += (0xfffffffu - ttcr_period) + 1; |
/* Cycles after "wrap" of section of TTCR which will cause a match and, |
potentially, an exception */ |
cycles_until_except = match_ttmr + (0x0fffffffu - match_ttcr) + 1; |
} |
|
switch (ttmr & SPR_TTMR_M) |
{ |
case 0: /* Disabled timer */ |
if (!match_time && (ttmr & SPR_TTMR_IE) && !(ttmr & SPR_TTMR_IP)) |
if (!cycles_until_except && (ttmr & SPR_TTMR_IE) && !(ttmr & SPR_TTMR_IP)) |
SCHED_ADD (tick_raise_except, NULL, 0); |
break; |
|
case SPR_TTMR_RT: /* Auto-restart timer */ |
SCHED_ADD (tick_restart, NULL, match_time); |
SCHED_ADD (tick_restart, NULL, cycles_until_except); |
if ((ttmr & SPR_TTMR_IE) && !(ttmr & SPR_TTMR_IP)) |
SCHED_ADD (tick_raise_except, NULL, match_time); |
SCHED_ADD (tick_raise_except, NULL, cycles_until_except); |
break; |
|
case SPR_TTMR_SR: /* One-shot timer */ |
if (tick_count) |
if (tick_counting) |
{ |
SCHED_ADD (tick_one_shot, NULL, match_time); |
SCHED_ADD (tick_one_shot, NULL, cycles_until_except); |
if ((ttmr & SPR_TTMR_IE) && !(ttmr & SPR_TTMR_IP)) |
SCHED_ADD (tick_raise_except, NULL, match_time); |
SCHED_ADD (tick_raise_except, NULL, cycles_until_except); |
} |
break; |
|
case SPR_TTMR_CR: /* Continuos timer */ |
if ((ttmr & SPR_TTMR_IE) && !(ttmr & SPR_TTMR_IP)) |
SCHED_ADD (tick_raise_except, NULL, match_time); |
SCHED_ADD (tick_raise_except, NULL, cycles_until_except); |
} |
} |
|
170,12 → 176,12
void |
spr_write_ttcr (uorreg_t value) |
{ |
cycles_start = runtime.sim.cycles - value; |
cycle_count_at_tick_start = runtime.sim.cycles - value; |
|
sched_timer_job (cpu_state.sprs[SPR_TTMR]); |
} |
|
/*! Value is the *previous* value of SPR_TTMR. The new one can be found in |
/*! prev_val is the *previous* value of SPR_TTMR. The new one can be found in |
cpu_state.sprs[SPR_TTMR] */ |
void |
spr_write_ttmr (uorreg_t prev_val) |
186,19 → 192,21
cpu_state.sprs[SPR_TTMR] &= ~SPR_TTMR_IP; |
|
/* If the timer was already disabled, ttcr should not be updated */ |
if (tick_count) |
if (tick_counting) |
{ |
cpu_state.sprs[SPR_TTCR] = runtime.sim.cycles - cycles_start; |
cpu_state.sprs[SPR_TTCR] = runtime.sim.cycles - cycle_count_at_tick_start; |
} |
|
cycles_start = runtime.sim.cycles - cpu_state.sprs[SPR_TTCR]; |
cycle_count_at_tick_start = runtime.sim.cycles - cpu_state.sprs[SPR_TTCR]; |
|
tick_count = value & SPR_TTMR_M; |
tick_counting = value & SPR_TTMR_M; |
|
if ((tick_count == 0xc0000000) && |
/* If TTCR==TTMR_TP when setting MR, we disable counting?? |
I think this should be looked at - Julius */ |
if ((tick_counting == SPR_TTMR_CR) && |
(cpu_state.sprs[SPR_TTCR] == (value & SPR_TTMR_TP))) |
{ |
tick_count = 0; |
tick_counting = 0; |
} |
|
sched_timer_job (prev_val); |
209,15 → 217,15
{ |
uorreg_t ret; |
|
if (!tick_count) |
if (!tick_counting) |
{ |
/* Report the time when the counter stoped (and don't carry on |
/* Report the time when the counter stopped (and don't carry on |
counting) */ |
ret = cpu_state.sprs[SPR_TTCR]; |
} |
else |
{ |
ret = runtime.sim.cycles - cycles_start; |
ret = runtime.sim.cycles - cycle_count_at_tick_start; |
} |
|
return ret; |
/openrisc/trunk/or1ksim/autom4te.cache/output.0
1,5 → 1,5
@%:@! /bin/sh |
@%:@ From configure.ac Id: configure.ac 552 2011-06-05 10:49:58Z julius using automake version AC_ACVERSION. |
@%:@ From configure.ac Id: configure.ac 556 2011-06-06 19:17:37Z julius using automake version AC_ACVERSION. |
@%:@ Guess values for system-dependent variables and create Makefiles. |
@%:@ Generated by GNU Autoconf 2.64 for or1ksim 2011-04-28. |
@%:@ |