From ae99af27ee1044750ec67b3872c1c563b4048e9f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 10 Nov 2015 22:44:38 +0800 Subject: [PATCH] runtime,gateware: use new misoc identifier --- artiq/gateware/targets/kc705.py | 5 ++++- artiq/gateware/targets/pipistrello.py | 5 ++++- artiq/runtime/clock.c | 6 ++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/artiq/gateware/targets/kc705.py b/artiq/gateware/targets/kc705.py index 54df3bb8a..a37a825aa 100755 --- a/artiq/gateware/targets/kc705.py +++ b/artiq/gateware/targets/kc705.py @@ -21,6 +21,7 @@ from artiq.gateware.soc import AMPSoC 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 @@ class _NIST_QCx(MiniSoC, AMPSoC): 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( diff --git a/artiq/gateware/targets/pipistrello.py b/artiq/gateware/targets/pipistrello.py index e0696ef9d..aa6957d61 100755 --- a/artiq/gateware/targets/pipistrello.py +++ b/artiq/gateware/targets/pipistrello.py @@ -21,6 +21,7 @@ from artiq.gateware.soc import AMPSoC 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 @@ class NIST_QC1(BaseSoC, AMPSoC): 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 diff --git a/artiq/runtime/clock.c b/artiq/runtime/clock.c index 0d0d3f4c3..63a72c1df 100644 --- a/artiq/runtime/clock.c +++ b/artiq/runtime/clock.c @@ -3,7 +3,6 @@ #include "log.h" #include "clock.h" -static int clkdiv; void clock_init(void) { @@ -11,7 +10,6 @@ void clock_init(void) 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); }