forked from M-Labs/artiq
1
0
Fork 0

runtime,gateware: use new misoc identifier

This commit is contained in:
Sebastien Bourdeauducq 2015-11-10 22:44:38 +08:00
parent 44c0c617f3
commit ae99af27ee
3 changed files with 10 additions and 6 deletions

View File

@ -21,6 +21,7 @@ from artiq.gateware.soc import AMPSoC
from artiq.gateware import rtio, nist_qc1, nist_qc2 from artiq.gateware import rtio, nist_qc1, nist_qc2
from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_7series, dds from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_7series, dds
from artiq.tools import artiq_dir from artiq.tools import artiq_dir
from artiq import __version__ as artiq_version
class _RTIOCRG(Module, AutoCSR): class _RTIOCRG(Module, AutoCSR):
@ -98,7 +99,9 @@ class _NIST_QCx(MiniSoC, AMPSoC):
cpu_type=cpu_type, cpu_type=cpu_type,
sdram_controller_type="minicon", sdram_controller_type="minicon",
l2_size=128*1024, l2_size=128*1024,
with_timer=False, **kwargs) with_timer=False,
ident=artiq_version,
**kwargs)
AMPSoC.__init__(self) AMPSoC.__init__(self)
self.submodules.leds = gpio.GPIOOut(Cat( self.submodules.leds = gpio.GPIOOut(Cat(

View File

@ -21,6 +21,7 @@ from artiq.gateware.soc import AMPSoC
from artiq.gateware import rtio, nist_qc1 from artiq.gateware import rtio, nist_qc1
from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_spartan6, dds from artiq.gateware.rtio.phy import ttl_simple, ttl_serdes_spartan6, dds
from artiq.tools import artiq_dir from artiq.tools import artiq_dir
from artiq import __version__ as artiq_version
class _RTIOCRG(Module, AutoCSR): class _RTIOCRG(Module, AutoCSR):
@ -118,7 +119,9 @@ class NIST_QC1(BaseSoC, AMPSoC):
BaseSoC.__init__(self, BaseSoC.__init__(self,
cpu_type=cpu_type, cpu_type=cpu_type,
l2_size=64*1024, l2_size=64*1024,
with_timer=False, **kwargs) with_timer=False,
ident=artiq_version,
**kwargs)
AMPSoC.__init__(self) AMPSoC.__init__(self)
platform = self.platform platform = self.platform

View File

@ -3,7 +3,6 @@
#include "log.h" #include "log.h"
#include "clock.h" #include "clock.h"
static int clkdiv;
void clock_init(void) void clock_init(void)
{ {
@ -11,7 +10,6 @@ void clock_init(void)
timer0_load_write(0x7fffffffffffffffLL); timer0_load_write(0x7fffffffffffffffLL);
timer0_reload_write(0x7fffffffffffffffLL); timer0_reload_write(0x7fffffffffffffffLL);
timer0_en_write(1); timer0_en_write(1);
clkdiv = identifier_frequency_read()/1000;
} }
long long int clock_get_ms(void) long long int clock_get_ms(void)
@ -22,7 +20,7 @@ long long int clock_get_ms(void)
timer0_update_value_write(1); timer0_update_value_write(1);
clock_sys = 0x7fffffffffffffffLL - timer0_value_read(); clock_sys = 0x7fffffffffffffffLL - timer0_value_read();
clock_ms = clock_sys/clkdiv; clock_ms = clock_sys/(SYSTEM_CLOCK_FREQUENCY/1000);
return clock_ms; return clock_ms;
} }
@ -31,7 +29,7 @@ void busywait_us(long long int us)
long long int threshold; long long int threshold;
timer0_update_value_write(1); 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) while(timer0_value_read() > threshold)
timer0_update_value_write(1); timer0_update_value_write(1);
} }