Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 4 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
View
3  build.py
@@ -5,8 +5,9 @@
from mibuild.platforms import m1
from mibuild.tools import write_to_file
+from milkymist import cif
+
import top
-import cif
def main():
platform = m1.Platform()
View
0  cif.py → milkymist/cif.py
File renamed without changes
View
17 milkymist/dvisampler/clocking.py
@@ -16,19 +16,6 @@ def __init__(self, pads):
###
- clk_dejitter = Signal()
- dcm_locked = Signal()
- self.specials += Instance("DCM_CLKGEN",
- Instance.Parameter("CLKIN_PERIOD", 26.7),
- Instance.Parameter("CLKFX_DIVIDE", 2),
- Instance.Parameter("CLKFX_MULTIPLY", 2),
- Instance.Parameter("CLKFX_MD_MAX", 1.0),
- Instance.Input("CLKIN", pads.clk),
- Instance.Input("RST", self._r_pll_reset.storage),
- Instance.Output("CLKFX", clk_dejitter),
- Instance.Output("LOCKED", dcm_locked)
- )
-
clkfbout = Signal()
pll_locked = Signal()
pll_clk0 = Signal()
@@ -52,8 +39,8 @@ def __init__(self, pads):
Instance.Output("CLKOUT3", pll_clk3),
Instance.Output("LOCKED", pll_locked),
Instance.Input("CLKFBIN", clkfbout),
- Instance.Input("CLKIN", clk_dejitter),
- Instance.Input("RST", ~dcm_locked)
+ Instance.Input("CLKIN", pads.clk),
+ Instance.Input("RST", self._r_pll_reset.storage)
)
locked_async = Signal()
View
47 software/videomixer/dvisamplerX.c
@@ -106,11 +106,13 @@ void dvisamplerX_adjust_phase(void)
switch(dvisamplerX_data0_cap_phase_read()) {
case DVISAMPLER_TOO_LATE:
dvisamplerX_data0_cap_dly_ctl_write(DVISAMPLER_DELAY_DEC);
+ while(dvisamplerX_data0_cap_dly_busy_read());
dvisamplerX_d0--;
dvisamplerX_data0_cap_phase_reset_write(1);
break;
case DVISAMPLER_TOO_EARLY:
dvisamplerX_data0_cap_dly_ctl_write(DVISAMPLER_DELAY_INC);
+ while(dvisamplerX_data0_cap_dly_busy_read());
dvisamplerX_d0++;
dvisamplerX_data0_cap_phase_reset_write(1);
break;
@@ -118,11 +120,13 @@ void dvisamplerX_adjust_phase(void)
switch(dvisamplerX_data1_cap_phase_read()) {
case DVISAMPLER_TOO_LATE:
dvisamplerX_data1_cap_dly_ctl_write(DVISAMPLER_DELAY_DEC);
+ while(dvisamplerX_data1_cap_dly_busy_read());
dvisamplerX_d1--;
dvisamplerX_data1_cap_phase_reset_write(1);
break;
case DVISAMPLER_TOO_EARLY:
dvisamplerX_data1_cap_dly_ctl_write(DVISAMPLER_DELAY_INC);
+ while(dvisamplerX_data1_cap_dly_busy_read());
dvisamplerX_d1++;
dvisamplerX_data1_cap_phase_reset_write(1);
break;
@@ -130,11 +134,13 @@ void dvisamplerX_adjust_phase(void)
switch(dvisamplerX_data2_cap_phase_read()) {
case DVISAMPLER_TOO_LATE:
dvisamplerX_data2_cap_dly_ctl_write(DVISAMPLER_DELAY_DEC);
+ while(dvisamplerX_data2_cap_dly_busy_read());
dvisamplerX_d2--;
dvisamplerX_data2_cap_phase_reset_write(1);
break;
case DVISAMPLER_TOO_EARLY:
dvisamplerX_data2_cap_dly_ctl_write(DVISAMPLER_DELAY_INC);
+ while(dvisamplerX_data2_cap_dly_busy_read());
dvisamplerX_d2++;
dvisamplerX_data2_cap_phase_reset_write(1);
break;
@@ -158,13 +164,36 @@ int dvisamplerX_init_phase(void)
return 0;
}
+int dvisamplerX_phase_startup(void)
+{
+ int ret;
+ int attempts;
+
+ attempts = 0;
+ while(1) {
+ attempts++;
+ dvisamplerX_calibrate_delays();
+ printf("dvisamplerX: delays calibrated\n");
+ ret = dvisamplerX_init_phase();
+ if(ret) {
+ printf("dvisamplerX: phase init OK\n");
+ return 1;
+ } else {
+ printf("dvisamplerX: phase did not settle\n");
+ if(attempts > 3) {
+ printf("dvisamplerX: giving up\n");
+ dvisamplerX_calibrate_delays();
+ return 0;
+ }
+ }
+ }
+}
+
static int dvisamplerX_locked;
static int dvisamplerX_last_event;
void dvisamplerX_service(void)
{
- int ret;
-
if(dvisamplerX_locked) {
if(dvisamplerX_clocking_locked_read()) {
if(elapsed(&dvisamplerX_last_event, identifier_frequency_read()/2)) {
@@ -178,21 +207,9 @@ void dvisamplerX_service(void)
} else {
if(dvisamplerX_clocking_locked_read()) {
printf("dvisamplerX: PLL locked\n");
- dvisamplerX_calibrate_delays();
- printf("dvisamplerX: delays calibrated\n");
- ret = dvisamplerX_init_phase();
- if(ret)
- printf("dvisamplerX: phase init OK\n");
- else
- printf("dvisamplerX: phase did not settle\n");
+ dvisamplerX_phase_startup();
dvisamplerX_print_status();
dvisamplerX_locked = 1;
- } else {
- if(elapsed(&dvisamplerX_last_event, identifier_frequency_read()/4)) {
- dvisamplerX_clocking_pll_reset_write(1);
- while(!elapsed(&dvisamplerX_last_event, identifier_frequency_read()/16));
- dvisamplerX_clocking_pll_reset_write(0);
- }
}
}
}
View
1  software/videomixer/dvisamplerX.h
@@ -7,6 +7,7 @@ void dvisamplerX_print_status(void);
void dvisamplerX_calibrate_delays(void);
void dvisamplerX_adjust_phase(void);
int dvisamplerX_init_phase(void);
+int dvisamplerX_phase_startup(void);
void dvisamplerX_service(void);
#endif
View
2  top.py
@@ -9,7 +9,7 @@
from milkymist import m1crg, lm32, norflash, uart, s6ddrphy, dfii, asmicon, \
identifier, timer, minimac3, framebuffer, asmiprobe, dvisampler, \
counteradc, gpio
-from cif import get_macros
+from milkymist.cif import get_macros
version = get_macros("common/version.h")["VERSION"][1:-1]

No commit comments for this range

Something went wrong with that request. Please try again.