sporniket / the-cradle-colorlight-i9-ecp5-amaranth-hdl

An implementation of "the cradle" for the ECP5-based colorlight i9 written with the Amaranth HDL
GNU Lesser General Public License v3.0
0 stars 0 forks source link

[ecp5] Instanciate a PLL #2

Closed sporniket closed 1 year ago

sporniket commented 1 year ago

Technical details

Automated tests

Given params a reference dictionary of parameter being :

{
    "p_PLLRST_ENA":"DISABLED",
    "p_INTFB_WAKE":"DISABLED",
    "p_STDBY_ENABLE":"DISABLED",
    "p_DPHASE_SOURCE":"DISABLED",
    "p_OUTDIVIDER_MUXA":"DIVA",
    "p_OUTDIVIDER_MUXB":"DIVB",
    "p_OUTDIVIDER_MUXC":"DIVC",
    "p_OUTDIVIDER_MUXD":"DIVD",
    "p_CLKI_DIV":5,
    "p_CLKOP_ENABLE":"ENABLED",
    "p_CLKOP_DIV":2,
    "p_CLKOP_CPHASE":1,
    "p_CLKOP_FPHASE":0,
    "p_CLKOS_ENABLE":"ENABLED",
    "p_CLKOS_DIV":5,
    "p_CLKOS_CPHASE":1,
    "p_CLKOS_FPHASE":0,
    "p_CLKOS2_ENABLE":"ENABLED",
    "p_CLKOS2_DIV":20,
    "p_CLKOS2_CPHASE":1,
    "p_CLKOS2_FPHASE":0,
    "p_CLKOS3_ENABLE":"ENABLED",
    "p_CLKOS3_DIV":17,
    "p_CLKOS3_CPHASE":1,
    "p_CLKOS3_FPHASE":0,
    "p_FEEDBK_PATH":"CLKOP",
    "p_CLKFB_DIV":54,
    "i_RST":0,
    "i_STDBY":0,
    "i_PHASESEL0":0,
    "i_PHASESEL1":0,
    "i_PHASEDIR":1,
    "i_PHASESTEP":1,
    "i_PHASELOADREG":1,
    "i_PLLWAKESYNC":0,
    "i_ENCLKOP":0
}

When instanciating with Ehxplll(params)

Then the resulting instance has the following properties :

{
    "i_CLKI":clkin,
    "i_CLKFB":clkout0,
    "o_CLKOP":clkout0,
    "o_CLKOS":clkout1,
    "o_CLKOS2":clkout2,
    "o_CLKOS3":clkout3,
    "o_LOCK":locked
}

Then the resulting instance has a method ouputPorts() that returns [clkout0,clkout1,clkout2,clkout3]

Then the resulting instance has a method ports() that returns [clkin,clkout0,clkout1,clkout2,clkout3,locked]

Use specific clock domain as input

When instanciating with Ehxplll(params, clockDomain="foo")

Then the property clkin is a ClockSignal with the domain foo

Use output as feedback

When the parameter p_FEEDBK_PATH has a value CLKOP,

Then the instance parameter i_CLKFB is given the output signal clkout0 and Ehxplll has no property intfb.

When the parameter p_FEEDBK_PATH has a value CLKOS,

Then the instance parameter i_CLKFB is given the output signal clkout1 and Ehxplll has no property intfb.

When the parameter p_FEEDBK_PATH has a value CLKOS2,

Then the instance parameter i_CLKFB is given the output signal clkout2 and Ehxplll has no property intfb.

When the parameter p_FEEDBK_PATH has a value CLKOS3,

Then the instance parameter i_CLKFB is given the output signal clkout3 and Ehxplll has no property intfb.

When the parameter p_FEEDBK_PATH has a value INT_OP,

Then the instance parameter i_CLKFB is given the output signal intfb that is a property of Ehxplll.

When the parameter p_FEEDBK_PATH has a value INT_OS,

Then the instance parameter i_CLKFB is given the output signal intfb that is a property of Ehxplll.

When the parameter p_FEEDBK_PATH has a value INT_OS2,

Then the instance parameter i_CLKFB is given the output signal intfb that is a property of Ehxplll.

When the parameter p_FEEDBK_PATH has a value INT_OS3,

Then the instance parameter i_CLKFB is given the output signal intfb that is a property of Ehxplll.

When the parameter p_FEEDBK_PATH has a value USERCLOCK and the instanciation is provided with a userFeedback signal,

Then the instance parameter i_CLKFB is given the output signal userFeedback that is a property of Ehxplll.