Skip to content

Commit

Permalink
runtime,gateware: use new misoc identifier
Browse files Browse the repository at this point in the history
sbourdeauducq committed Nov 10, 2015
1 parent 44c0c61 commit ae99af2
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion artiq/gateware/targets/kc705.py
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
from artiq.gateware import rtio, nist_qc1, nist_qc2
from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_7series, dds
from artiq.tools import artiq_dir
from artiq import __version__ as artiq_version


class _RTIOCRG(Module, AutoCSR):
@@ -98,7 +99,9 @@ def __init__(self, cpu_type="or1k", **kwargs):
cpu_type=cpu_type,
sdram_controller_type="minicon",
l2_size=128*1024,
with_timer=False, **kwargs)
with_timer=False,
ident=artiq_version,
**kwargs)
AMPSoC.__init__(self)

self.submodules.leds = gpio.GPIOOut(Cat(
5 changes: 4 additions & 1 deletion artiq/gateware/targets/pipistrello.py
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
from artiq.gateware import rtio, nist_qc1
from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_spartan6, dds
from artiq.tools import artiq_dir
from artiq import __version__ as artiq_version


class _RTIOCRG(Module, AutoCSR):
@@ -118,7 +119,9 @@ def __init__(self, cpu_type="or1k", **kwargs):
BaseSoC.__init__(self,
cpu_type=cpu_type,
l2_size=64*1024,
with_timer=False, **kwargs)
with_timer=False,
ident=artiq_version,
**kwargs)
AMPSoC.__init__(self)

platform = self.platform
6 changes: 2 additions & 4 deletions artiq/runtime/clock.c
Original file line number Diff line number Diff line change
@@ -3,15 +3,13 @@
#include "log.h"
#include "clock.h"

static int clkdiv;

void clock_init(void)
{
timer0_en_write(0);
timer0_load_write(0x7fffffffffffffffLL);
timer0_reload_write(0x7fffffffffffffffLL);
timer0_en_write(1);
clkdiv = identifier_frequency_read()/1000;
}

long long int clock_get_ms(void)
@@ -22,7 +20,7 @@ long long int clock_get_ms(void)
timer0_update_value_write(1);
clock_sys = 0x7fffffffffffffffLL - timer0_value_read();

clock_ms = clock_sys/clkdiv;
clock_ms = clock_sys/(SYSTEM_CLOCK_FREQUENCY/1000);
return clock_ms;
}

@@ -31,7 +29,7 @@ void busywait_us(long long int us)
long long int threshold;

timer0_update_value_write(1);
threshold = timer0_value_read() - us*(long long int)identifier_frequency_read()/1000000LL;
threshold = timer0_value_read() - us*SYSTEM_CLOCK_FREQUENCY/1000000LL;
while(timer0_value_read() > threshold)
timer0_update_value_write(1);
}

0 comments on commit ae99af2

Please sign in to comment.