1 // 2 // Copyright (c) 2010-2025 Antmicro 3 // Copyright (c) 2022-2025 Silicon Labs 4 // 5 // This file is licensed under the MIT License. 6 // Full license text is available in 'licenses/MIT.txt'. 7 // 8 9 /* WARNING: Auto-Generated Peripheral - DO NOT EDIT 10 DPLL, Generated on : 2024-12-17 18:14:44.951341 11 DPLL, ID Version : 03b70bbe4726417baff81670ec0ddd1d.1 */ 12 13 /* Here is the template for your defined by hand class. Don't forget to add your eventual constructor with extra parameter. 14 15 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 16 using System; 17 using System.IO; 18 using System.Collections.Generic; 19 using Antmicro.Renode.Core; 20 using Antmicro.Renode.Core.Structure.Registers; 21 using Antmicro.Renode.Logging; 22 using Antmicro.Renode.Exceptions; 23 using Antmicro.Renode.Peripherals.CPU; 24 using Antmicro.Renode.Peripherals.Bus; 25 26 namespace Antmicro.Renode.Peripherals.Miscellaneous.SiLabs 27 { 28 public partial class EFR32xG2_DPLL_1 29 { 30 public EFR32xG2_DPLL_1(Machine machine) : base(machine) 31 { 32 EFR32xG2_DPLL_1_constructor(); 33 } 34 } 35 } 36 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 37 38 using System; 39 using System.IO; 40 using System.Collections.Generic; 41 using Antmicro.Renode.Core; 42 using Antmicro.Renode.Core.Structure.Registers; 43 using Antmicro.Renode.Logging; 44 using Antmicro.Renode.Exceptions; 45 using Antmicro.Renode.Peripherals.Bus; 46 47 48 namespace Antmicro.Renode.Peripherals.Miscellaneous.SiLabs 49 { 50 public partial class EFR32xG2_DPLL_1 : BasicDoubleWordPeripheral, IKnownSize 51 { EFR32xG2_DPLL_1(Machine machine)52 public EFR32xG2_DPLL_1(Machine machine) : base(machine) 53 { 54 Define_Registers(); 55 EFR32xG2_DPLL_1_Constructor(); 56 } 57 Define_Registers()58 private void Define_Registers() 59 { 60 var registersMap = new Dictionary<long, DoubleWordRegister> 61 { 62 {(long)Registers.Ipversion, GenerateIpversionRegister()}, 63 {(long)Registers.En, GenerateEnRegister()}, 64 {(long)Registers.Cfg, GenerateCfgRegister()}, 65 {(long)Registers.Cfg1, GenerateCfg1Register()}, 66 {(long)Registers.If, GenerateIfRegister()}, 67 {(long)Registers.Ien, GenerateIenRegister()}, 68 {(long)Registers.Status, GenerateStatusRegister()}, 69 {(long)Registers.Debugstatus, GenerateDebugstatusRegister()}, 70 {(long)Registers.Offset, GenerateOffsetRegister()}, 71 {(long)Registers.Lock, GenerateLockRegister()}, 72 }; 73 registers = new DoubleWordRegisterCollection(this, registersMap); 74 } 75 Reset()76 public override void Reset() 77 { 78 base.Reset(); 79 DPLL_Reset(); 80 } 81 82 protected enum CFG_MODE 83 { 84 FLL = 0, // Frequency Lock Mode 85 PLL = 1, // Phase Lock Mode 86 } 87 88 protected enum STATUS_LOCK 89 { 90 UNLOCKED = 0, // DPLL is unlocked 91 LOCKED = 1, // DPLL is locked 92 } 93 94 // Ipversion - Offset : 0x0 GenerateIpversionRegister()95 protected DoubleWordRegister GenerateIpversionRegister() => new DoubleWordRegister(this, 0x1) 96 97 .WithValueField(0, 32, out ipversion_ipversion_field, FieldMode.Read, 98 valueProviderCallback: (_) => { 99 Ipversion_Ipversion_ValueProvider(_); 100 return ipversion_ipversion_field.Value; 101 }, 102 103 readCallback: (_, __) => Ipversion_Ipversion_Read(_, __), 104 name: "Ipversion") 105 .WithReadCallback((_, __) => Ipversion_Read(_, __)) 106 .WithWriteCallback((_, __) => Ipversion_Write(_, __)); 107 108 // En - Offset : 0x4 GenerateEnRegister()109 protected DoubleWordRegister GenerateEnRegister() => new DoubleWordRegister(this, 0x0) 110 .WithFlag(0, out en_en_bit, 111 valueProviderCallback: (_) => { 112 En_En_ValueProvider(_); 113 return en_en_bit.Value; 114 }, 115 116 writeCallback: (_, __) => En_En_Write(_, __), 117 118 readCallback: (_, __) => En_En_Read(_, __), 119 name: "En") 120 .WithFlag(1, out en_disabling_bit, FieldMode.Read, 121 valueProviderCallback: (_) => { 122 En_Disabling_ValueProvider(_); 123 return en_disabling_bit.Value; 124 }, 125 126 readCallback: (_, __) => En_Disabling_Read(_, __), 127 name: "Disabling") 128 .WithReservedBits(2, 30) 129 .WithReadCallback((_, __) => En_Read(_, __)) 130 .WithWriteCallback((_, __) => En_Write(_, __)); 131 132 // Cfg - Offset : 0x8 GenerateCfgRegister()133 protected DoubleWordRegister GenerateCfgRegister() => new DoubleWordRegister(this, 0x0) 134 .WithEnumField<DoubleWordRegister, CFG_MODE>(0, 1, out cfg_mode_bit, 135 valueProviderCallback: (_) => { 136 Cfg_Mode_ValueProvider(_); 137 return cfg_mode_bit.Value; 138 }, 139 writeCallback: (_, __) => { 140 WriteWSTATIC(); 141 Cfg_Mode_Write(_, __); 142 }, 143 144 readCallback: (_, __) => Cfg_Mode_Read(_, __), 145 name: "Mode") 146 .WithFlag(1, out cfg_edgesel_bit, 147 valueProviderCallback: (_) => { 148 Cfg_Edgesel_ValueProvider(_); 149 return cfg_edgesel_bit.Value; 150 }, 151 writeCallback: (_, __) => { 152 WriteWSTATIC(); 153 Cfg_Edgesel_Write(_, __); 154 }, 155 156 readCallback: (_, __) => Cfg_Edgesel_Read(_, __), 157 name: "Edgesel") 158 .WithFlag(2, out cfg_autorecover_bit, 159 valueProviderCallback: (_) => { 160 Cfg_Autorecover_ValueProvider(_); 161 return cfg_autorecover_bit.Value; 162 }, 163 writeCallback: (_, __) => { 164 WriteWSTATIC(); 165 Cfg_Autorecover_Write(_, __); 166 }, 167 168 readCallback: (_, __) => Cfg_Autorecover_Read(_, __), 169 name: "Autorecover") 170 .WithReservedBits(3, 3) 171 .WithFlag(6, out cfg_dithen_bit, 172 valueProviderCallback: (_) => { 173 Cfg_Dithen_ValueProvider(_); 174 return cfg_dithen_bit.Value; 175 }, 176 writeCallback: (_, __) => { 177 WriteWSTATIC(); 178 Cfg_Dithen_Write(_, __); 179 }, 180 181 readCallback: (_, __) => Cfg_Dithen_Read(_, __), 182 name: "Dithen") 183 .WithReservedBits(7, 25) 184 .WithReadCallback((_, __) => Cfg_Read(_, __)) 185 .WithWriteCallback((_, __) => Cfg_Write_WithHook(_, __)); 186 187 // Cfg1 - Offset : 0xC GenerateCfg1Register()188 protected DoubleWordRegister GenerateCfg1Register() => new DoubleWordRegister(this, 0x0) 189 190 .WithValueField(0, 12, out cfg1_m_field, 191 valueProviderCallback: (_) => { 192 Cfg1_M_ValueProvider(_); 193 return cfg1_m_field.Value; 194 }, 195 writeCallback: (_, __) => { 196 WriteWSTATIC(); 197 Cfg1_M_Write(_, __); 198 }, 199 200 readCallback: (_, __) => Cfg1_M_Read(_, __), 201 name: "M") 202 .WithReservedBits(12, 4) 203 204 .WithValueField(16, 12, out cfg1_n_field, 205 valueProviderCallback: (_) => { 206 Cfg1_N_ValueProvider(_); 207 return cfg1_n_field.Value; 208 }, 209 writeCallback: (_, __) => { 210 WriteWSTATIC(); 211 Cfg1_N_Write(_, __); 212 }, 213 214 readCallback: (_, __) => Cfg1_N_Read(_, __), 215 name: "N") 216 .WithReservedBits(28, 4) 217 .WithReadCallback((_, __) => Cfg1_Read(_, __)) 218 .WithWriteCallback((_, __) => Cfg1_Write(_, __)); 219 220 // If - Offset : 0x10 GenerateIfRegister()221 protected DoubleWordRegister GenerateIfRegister() => new DoubleWordRegister(this, 0x0) 222 .WithFlag(0, out if_lock_bit, 223 valueProviderCallback: (_) => { 224 If_Lock_ValueProvider(_); 225 return if_lock_bit.Value; 226 }, 227 228 writeCallback: (_, __) => If_Lock_Write(_, __), 229 230 readCallback: (_, __) => If_Lock_Read(_, __), 231 name: "Lock") 232 .WithFlag(1, out if_lockfaillow_bit, 233 valueProviderCallback: (_) => { 234 If_Lockfaillow_ValueProvider(_); 235 return if_lockfaillow_bit.Value; 236 }, 237 238 writeCallback: (_, __) => If_Lockfaillow_Write(_, __), 239 240 readCallback: (_, __) => If_Lockfaillow_Read(_, __), 241 name: "Lockfaillow") 242 .WithFlag(2, out if_lockfailhigh_bit, 243 valueProviderCallback: (_) => { 244 If_Lockfailhigh_ValueProvider(_); 245 return if_lockfailhigh_bit.Value; 246 }, 247 248 writeCallback: (_, __) => If_Lockfailhigh_Write(_, __), 249 250 readCallback: (_, __) => If_Lockfailhigh_Read(_, __), 251 name: "Lockfailhigh") 252 .WithReservedBits(3, 29) 253 .WithReadCallback((_, __) => If_Read(_, __)) 254 .WithWriteCallback((_, __) => If_Write(_, __)); 255 256 // Ien - Offset : 0x14 GenerateIenRegister()257 protected DoubleWordRegister GenerateIenRegister() => new DoubleWordRegister(this, 0x0) 258 .WithFlag(0, out ien_lock_bit, 259 valueProviderCallback: (_) => { 260 Ien_Lock_ValueProvider(_); 261 return ien_lock_bit.Value; 262 }, 263 264 writeCallback: (_, __) => Ien_Lock_Write(_, __), 265 266 readCallback: (_, __) => Ien_Lock_Read(_, __), 267 name: "Lock") 268 .WithFlag(1, out ien_lockfaillow_bit, 269 valueProviderCallback: (_) => { 270 Ien_Lockfaillow_ValueProvider(_); 271 return ien_lockfaillow_bit.Value; 272 }, 273 274 writeCallback: (_, __) => Ien_Lockfaillow_Write(_, __), 275 276 readCallback: (_, __) => Ien_Lockfaillow_Read(_, __), 277 name: "Lockfaillow") 278 .WithFlag(2, out ien_lockfailhigh_bit, 279 valueProviderCallback: (_) => { 280 Ien_Lockfailhigh_ValueProvider(_); 281 return ien_lockfailhigh_bit.Value; 282 }, 283 284 writeCallback: (_, __) => Ien_Lockfailhigh_Write(_, __), 285 286 readCallback: (_, __) => Ien_Lockfailhigh_Read(_, __), 287 name: "Lockfailhigh") 288 .WithReservedBits(3, 29) 289 .WithReadCallback((_, __) => Ien_Read(_, __)) 290 .WithWriteCallback((_, __) => Ien_Write(_, __)); 291 292 // Status - Offset : 0x18 GenerateStatusRegister()293 protected DoubleWordRegister GenerateStatusRegister() => new DoubleWordRegister(this, 0x0) 294 .WithFlag(0, out status_rdy_bit, FieldMode.Read, 295 valueProviderCallback: (_) => { 296 Status_Rdy_ValueProvider(_); 297 return status_rdy_bit.Value; 298 }, 299 300 readCallback: (_, __) => Status_Rdy_Read(_, __), 301 name: "Rdy") 302 .WithFlag(1, out status_ens_bit, FieldMode.Read, 303 valueProviderCallback: (_) => { 304 Status_Ens_ValueProvider(_); 305 return status_ens_bit.Value; 306 }, 307 308 readCallback: (_, __) => Status_Ens_Read(_, __), 309 name: "Ens") 310 .WithReservedBits(2, 29) 311 .WithEnumField<DoubleWordRegister, STATUS_LOCK>(31, 1, out status_lock_bit, FieldMode.Read, 312 valueProviderCallback: (_) => { 313 Status_Lock_ValueProvider(_); 314 return status_lock_bit.Value; 315 }, 316 317 readCallback: (_, __) => Status_Lock_Read(_, __), 318 name: "Lock") 319 .WithReadCallback((_, __) => Status_Read(_, __)) 320 .WithWriteCallback((_, __) => Status_Write(_, __)); 321 322 // Debugstatus - Offset : 0x1C GenerateDebugstatusRegister()323 protected DoubleWordRegister GenerateDebugstatusRegister() => new DoubleWordRegister(this, 0x0) 324 325 .WithValueField(0, 4, out debugstatus_dither_field, FieldMode.Read, 326 valueProviderCallback: (_) => { 327 Debugstatus_Dither_ValueProvider(_); 328 return debugstatus_dither_field.Value; 329 }, 330 331 readCallback: (_, __) => Debugstatus_Dither_Read(_, __), 332 name: "Dither") 333 .WithReservedBits(4, 28) 334 .WithReadCallback((_, __) => Debugstatus_Read(_, __)) 335 .WithWriteCallback((_, __) => Debugstatus_Write(_, __)); 336 337 // Offset - Offset : 0x20 GenerateOffsetRegister()338 protected DoubleWordRegister GenerateOffsetRegister() => new DoubleWordRegister(this, 0x5A880) 339 .WithReservedBits(0, 4) 340 .WithFlag(4, out offset_updateen_bit, 341 valueProviderCallback: (_) => { 342 Offset_Updateen_ValueProvider(_); 343 return offset_updateen_bit.Value; 344 }, 345 346 writeCallback: (_, __) => Offset_Updateen_Write(_, __), 347 348 readCallback: (_, __) => Offset_Updateen_Read(_, __), 349 name: "Updateen") 350 351 .WithValueField(5, 11, out offset_k0_field, 352 valueProviderCallback: (_) => { 353 Offset_K0_ValueProvider(_); 354 return offset_k0_field.Value; 355 }, 356 357 writeCallback: (_, __) => Offset_K0_Write(_, __), 358 359 readCallback: (_, __) => Offset_K0_Read(_, __), 360 name: "K0") 361 362 .WithValueField(16, 4, out offset_coarsecount_field, 363 valueProviderCallback: (_) => { 364 Offset_Coarsecount_ValueProvider(_); 365 return offset_coarsecount_field.Value; 366 }, 367 368 writeCallback: (_, __) => Offset_Coarsecount_Write(_, __), 369 370 readCallback: (_, __) => Offset_Coarsecount_Read(_, __), 371 name: "Coarsecount") 372 373 .WithValueField(20, 6, out offset_mincoarse_field, 374 valueProviderCallback: (_) => { 375 Offset_Mincoarse_ValueProvider(_); 376 return offset_mincoarse_field.Value; 377 }, 378 379 writeCallback: (_, __) => Offset_Mincoarse_Write(_, __), 380 381 readCallback: (_, __) => Offset_Mincoarse_Read(_, __), 382 name: "Mincoarse") 383 .WithReservedBits(26, 6) 384 .WithReadCallback((_, __) => Offset_Read(_, __)) 385 .WithWriteCallback((_, __) => Offset_Write(_, __)); 386 387 // Lock - Offset : 0x24 GenerateLockRegister()388 protected DoubleWordRegister GenerateLockRegister() => new DoubleWordRegister(this, 0x7102) 389 390 .WithValueField(0, 16, out lock_lockkey_field, FieldMode.Write, 391 392 writeCallback: (_, __) => Lock_Lockkey_Write(_, __), 393 name: "Lockkey") 394 .WithReservedBits(16, 16) 395 .WithReadCallback((_, __) => Lock_Read(_, __)) 396 .WithWriteCallback((_, __) => Lock_Write(_, __)); 397 398 ReadWFIFO()399 private uint ReadWFIFO() 400 { 401 this.Log(LogLevel.Warning, "Reading from a WFIFO Field, value returned will always be 0"); 402 return 0x0; 403 } 404 ReadLFWSYNC()405 private uint ReadLFWSYNC() 406 { 407 this.Log(LogLevel.Warning, "Reading from a LFWSYNC/HVLFWSYNC Field, value returned will always be 0"); 408 return 0x0; 409 } 410 ReadRFIFO()411 private uint ReadRFIFO() 412 { 413 this.Log(LogLevel.Warning, "Reading from a RFIFO Field, value returned will always be 0"); 414 return 0x0; 415 } 416 417 WriteWSTATIC()418 private void WriteWSTATIC() 419 { 420 if(Enabled) 421 { 422 this.Log(LogLevel.Error, "Trying to write to a WSTATIC register while peripheral is enabled EN = {0}", Enabled); 423 } 424 } 425 426 427 428 429 // Ipversion - Offset : 0x0 430 431 protected IValueRegisterField ipversion_ipversion_field; Ipversion_Ipversion_Read(ulong a, ulong b)432 partial void Ipversion_Ipversion_Read(ulong a, ulong b); Ipversion_Ipversion_ValueProvider(ulong a)433 partial void Ipversion_Ipversion_ValueProvider(ulong a); Ipversion_Write(uint a, uint b)434 partial void Ipversion_Write(uint a, uint b); Ipversion_Read(uint a, uint b)435 partial void Ipversion_Read(uint a, uint b); 436 437 // En - Offset : 0x4 438 439 protected IFlagRegisterField en_en_bit; En_En_Write(bool a, bool b)440 partial void En_En_Write(bool a, bool b); En_En_Read(bool a, bool b)441 partial void En_En_Read(bool a, bool b); En_En_ValueProvider(bool a)442 partial void En_En_ValueProvider(bool a); 443 444 protected IFlagRegisterField en_disabling_bit; En_Disabling_Read(bool a, bool b)445 partial void En_Disabling_Read(bool a, bool b); En_Disabling_ValueProvider(bool a)446 partial void En_Disabling_ValueProvider(bool a); En_Write(uint a, uint b)447 partial void En_Write(uint a, uint b); En_Read(uint a, uint b)448 partial void En_Read(uint a, uint b); 449 450 // Cfg - Offset : 0x8 451 452 protected IEnumRegisterField<CFG_MODE> cfg_mode_bit; Cfg_Mode_Write(CFG_MODE a, CFG_MODE b)453 partial void Cfg_Mode_Write(CFG_MODE a, CFG_MODE b); Cfg_Mode_Read(CFG_MODE a, CFG_MODE b)454 partial void Cfg_Mode_Read(CFG_MODE a, CFG_MODE b); Cfg_Mode_ValueProvider(CFG_MODE a)455 partial void Cfg_Mode_ValueProvider(CFG_MODE a); 456 457 protected IFlagRegisterField cfg_edgesel_bit; Cfg_Edgesel_Write(bool a, bool b)458 partial void Cfg_Edgesel_Write(bool a, bool b); Cfg_Edgesel_Read(bool a, bool b)459 partial void Cfg_Edgesel_Read(bool a, bool b); Cfg_Edgesel_ValueProvider(bool a)460 partial void Cfg_Edgesel_ValueProvider(bool a); 461 462 protected IFlagRegisterField cfg_autorecover_bit; Cfg_Autorecover_Write(bool a, bool b)463 partial void Cfg_Autorecover_Write(bool a, bool b); Cfg_Autorecover_Read(bool a, bool b)464 partial void Cfg_Autorecover_Read(bool a, bool b); Cfg_Autorecover_ValueProvider(bool a)465 partial void Cfg_Autorecover_ValueProvider(bool a); 466 467 protected IFlagRegisterField cfg_dithen_bit; Cfg_Dithen_Write(bool a, bool b)468 partial void Cfg_Dithen_Write(bool a, bool b); Cfg_Dithen_Read(bool a, bool b)469 partial void Cfg_Dithen_Read(bool a, bool b); Cfg_Dithen_ValueProvider(bool a)470 partial void Cfg_Dithen_ValueProvider(bool a); Cfg_Write_WithHook(uint a, uint b)471 protected void Cfg_Write_WithHook(uint a, uint b) 472 { 473 if (status_lock_bit.Value == STATUS_LOCK.LOCKED) 474 { 475 this.Log(LogLevel.Error, "Cfg: Write access to a locked register"); 476 } 477 Cfg_Write(a, b); 478 } Cfg_Write(uint a, uint b)479 partial void Cfg_Write(uint a, uint b); Cfg_Read(uint a, uint b)480 partial void Cfg_Read(uint a, uint b); 481 482 // Cfg1 - Offset : 0xC 483 484 protected IValueRegisterField cfg1_m_field; Cfg1_M_Write(ulong a, ulong b)485 partial void Cfg1_M_Write(ulong a, ulong b); Cfg1_M_Read(ulong a, ulong b)486 partial void Cfg1_M_Read(ulong a, ulong b); Cfg1_M_ValueProvider(ulong a)487 partial void Cfg1_M_ValueProvider(ulong a); 488 489 protected IValueRegisterField cfg1_n_field; Cfg1_N_Write(ulong a, ulong b)490 partial void Cfg1_N_Write(ulong a, ulong b); Cfg1_N_Read(ulong a, ulong b)491 partial void Cfg1_N_Read(ulong a, ulong b); Cfg1_N_ValueProvider(ulong a)492 partial void Cfg1_N_ValueProvider(ulong a); Cfg1_Write(uint a, uint b)493 partial void Cfg1_Write(uint a, uint b); Cfg1_Read(uint a, uint b)494 partial void Cfg1_Read(uint a, uint b); 495 496 // If - Offset : 0x10 497 498 protected IFlagRegisterField if_lock_bit; If_Lock_Write(bool a, bool b)499 partial void If_Lock_Write(bool a, bool b); If_Lock_Read(bool a, bool b)500 partial void If_Lock_Read(bool a, bool b); If_Lock_ValueProvider(bool a)501 partial void If_Lock_ValueProvider(bool a); 502 503 protected IFlagRegisterField if_lockfaillow_bit; If_Lockfaillow_Write(bool a, bool b)504 partial void If_Lockfaillow_Write(bool a, bool b); If_Lockfaillow_Read(bool a, bool b)505 partial void If_Lockfaillow_Read(bool a, bool b); If_Lockfaillow_ValueProvider(bool a)506 partial void If_Lockfaillow_ValueProvider(bool a); 507 508 protected IFlagRegisterField if_lockfailhigh_bit; If_Lockfailhigh_Write(bool a, bool b)509 partial void If_Lockfailhigh_Write(bool a, bool b); If_Lockfailhigh_Read(bool a, bool b)510 partial void If_Lockfailhigh_Read(bool a, bool b); If_Lockfailhigh_ValueProvider(bool a)511 partial void If_Lockfailhigh_ValueProvider(bool a); If_Write(uint a, uint b)512 partial void If_Write(uint a, uint b); If_Read(uint a, uint b)513 partial void If_Read(uint a, uint b); 514 515 // Ien - Offset : 0x14 516 517 protected IFlagRegisterField ien_lock_bit; Ien_Lock_Write(bool a, bool b)518 partial void Ien_Lock_Write(bool a, bool b); Ien_Lock_Read(bool a, bool b)519 partial void Ien_Lock_Read(bool a, bool b); Ien_Lock_ValueProvider(bool a)520 partial void Ien_Lock_ValueProvider(bool a); 521 522 protected IFlagRegisterField ien_lockfaillow_bit; Ien_Lockfaillow_Write(bool a, bool b)523 partial void Ien_Lockfaillow_Write(bool a, bool b); Ien_Lockfaillow_Read(bool a, bool b)524 partial void Ien_Lockfaillow_Read(bool a, bool b); Ien_Lockfaillow_ValueProvider(bool a)525 partial void Ien_Lockfaillow_ValueProvider(bool a); 526 527 protected IFlagRegisterField ien_lockfailhigh_bit; Ien_Lockfailhigh_Write(bool a, bool b)528 partial void Ien_Lockfailhigh_Write(bool a, bool b); Ien_Lockfailhigh_Read(bool a, bool b)529 partial void Ien_Lockfailhigh_Read(bool a, bool b); Ien_Lockfailhigh_ValueProvider(bool a)530 partial void Ien_Lockfailhigh_ValueProvider(bool a); Ien_Write(uint a, uint b)531 partial void Ien_Write(uint a, uint b); Ien_Read(uint a, uint b)532 partial void Ien_Read(uint a, uint b); 533 534 // Status - Offset : 0x18 535 536 protected IFlagRegisterField status_rdy_bit; Status_Rdy_Read(bool a, bool b)537 partial void Status_Rdy_Read(bool a, bool b); Status_Rdy_ValueProvider(bool a)538 partial void Status_Rdy_ValueProvider(bool a); 539 540 protected IFlagRegisterField status_ens_bit; Status_Ens_Read(bool a, bool b)541 partial void Status_Ens_Read(bool a, bool b); Status_Ens_ValueProvider(bool a)542 partial void Status_Ens_ValueProvider(bool a); 543 544 protected IEnumRegisterField<STATUS_LOCK> status_lock_bit; Status_Lock_Read(STATUS_LOCK a, STATUS_LOCK b)545 partial void Status_Lock_Read(STATUS_LOCK a, STATUS_LOCK b); Status_Lock_ValueProvider(STATUS_LOCK a)546 partial void Status_Lock_ValueProvider(STATUS_LOCK a); Status_Write(uint a, uint b)547 partial void Status_Write(uint a, uint b); Status_Read(uint a, uint b)548 partial void Status_Read(uint a, uint b); 549 550 // Debugstatus - Offset : 0x1C 551 552 protected IValueRegisterField debugstatus_dither_field; Debugstatus_Dither_Read(ulong a, ulong b)553 partial void Debugstatus_Dither_Read(ulong a, ulong b); Debugstatus_Dither_ValueProvider(ulong a)554 partial void Debugstatus_Dither_ValueProvider(ulong a); Debugstatus_Write(uint a, uint b)555 partial void Debugstatus_Write(uint a, uint b); Debugstatus_Read(uint a, uint b)556 partial void Debugstatus_Read(uint a, uint b); 557 558 // Offset - Offset : 0x20 559 560 protected IFlagRegisterField offset_updateen_bit; Offset_Updateen_Write(bool a, bool b)561 partial void Offset_Updateen_Write(bool a, bool b); Offset_Updateen_Read(bool a, bool b)562 partial void Offset_Updateen_Read(bool a, bool b); Offset_Updateen_ValueProvider(bool a)563 partial void Offset_Updateen_ValueProvider(bool a); 564 565 protected IValueRegisterField offset_k0_field; Offset_K0_Write(ulong a, ulong b)566 partial void Offset_K0_Write(ulong a, ulong b); Offset_K0_Read(ulong a, ulong b)567 partial void Offset_K0_Read(ulong a, ulong b); Offset_K0_ValueProvider(ulong a)568 partial void Offset_K0_ValueProvider(ulong a); 569 570 protected IValueRegisterField offset_coarsecount_field; Offset_Coarsecount_Write(ulong a, ulong b)571 partial void Offset_Coarsecount_Write(ulong a, ulong b); Offset_Coarsecount_Read(ulong a, ulong b)572 partial void Offset_Coarsecount_Read(ulong a, ulong b); Offset_Coarsecount_ValueProvider(ulong a)573 partial void Offset_Coarsecount_ValueProvider(ulong a); 574 575 protected IValueRegisterField offset_mincoarse_field; Offset_Mincoarse_Write(ulong a, ulong b)576 partial void Offset_Mincoarse_Write(ulong a, ulong b); Offset_Mincoarse_Read(ulong a, ulong b)577 partial void Offset_Mincoarse_Read(ulong a, ulong b); Offset_Mincoarse_ValueProvider(ulong a)578 partial void Offset_Mincoarse_ValueProvider(ulong a); Offset_Write(uint a, uint b)579 partial void Offset_Write(uint a, uint b); Offset_Read(uint a, uint b)580 partial void Offset_Read(uint a, uint b); 581 582 // Lock - Offset : 0x24 583 584 protected IValueRegisterField lock_lockkey_field; Lock_Lockkey_Write(ulong a, ulong b)585 partial void Lock_Lockkey_Write(ulong a, ulong b); Lock_Lockkey_ValueProvider(ulong a)586 partial void Lock_Lockkey_ValueProvider(ulong a); Lock_Write(uint a, uint b)587 partial void Lock_Write(uint a, uint b); Lock_Read(uint a, uint b)588 partial void Lock_Read(uint a, uint b); DPLL_Reset()589 partial void DPLL_Reset(); 590 EFR32xG2_DPLL_1_Constructor()591 partial void EFR32xG2_DPLL_1_Constructor(); 592 593 public bool Enabled 594 { 595 get 596 { 597 return en_en_bit.Value; 598 } 599 set 600 { 601 en_en_bit.Value = value; 602 } 603 } 604 605 private ICMU_EFR32xG2 _cmu; 606 private ICMU_EFR32xG2 cmu 607 { 608 get 609 { 610 if (Object.ReferenceEquals(_cmu, null)) 611 { 612 foreach(var cmu in machine.GetPeripheralsOfType<ICMU_EFR32xG2>()) 613 { 614 _cmu = cmu; 615 } 616 } 617 return _cmu; 618 } 619 set 620 { 621 _cmu = value; 622 } 623 } 624 ReadDoubleWord(long address)625 public override uint ReadDoubleWord(long address) 626 { 627 long temp = address & 0x0FFF; 628 switch(address & 0x3000){ 629 case 0x0000: 630 return registers.Read(temp); 631 default: 632 this.Log(LogLevel.Warning, "Reading from Set/Clr/Tgl is not supported."); 633 return registers.Read(temp); 634 } 635 } 636 WriteDoubleWord(long address, uint value)637 public override void WriteDoubleWord(long address, uint value) 638 { 639 long temp = address & 0x0FFF; 640 switch(address & 0x3000){ 641 case 0x0000: 642 registers.Write(temp, value); 643 break; 644 case 0x1000: 645 registers.Write(temp, registers.Read(temp) | value); 646 break; 647 case 0x2000: 648 registers.Write(temp, registers.Read(temp) & ~value); 649 break; 650 case 0x3000: 651 registers.Write(temp, registers.Read(temp) ^ value); 652 break; 653 default: 654 this.Log(LogLevel.Error, "writing doubleWord to non existing offset {0:X}, case : {1:X}", address, address & 0x3000); 655 break; 656 } 657 } 658 659 protected enum Registers 660 { 661 Ipversion = 0x0, 662 En = 0x4, 663 Cfg = 0x8, 664 Cfg1 = 0xC, 665 If = 0x10, 666 Ien = 0x14, 667 Status = 0x18, 668 Debugstatus = 0x1C, 669 Offset = 0x20, 670 Lock = 0x24, 671 672 Ipversion_SET = 0x1000, 673 En_SET = 0x1004, 674 Cfg_SET = 0x1008, 675 Cfg1_SET = 0x100C, 676 If_SET = 0x1010, 677 Ien_SET = 0x1014, 678 Status_SET = 0x1018, 679 Debugstatus_SET = 0x101C, 680 Offset_SET = 0x1020, 681 Lock_SET = 0x1024, 682 683 Ipversion_CLR = 0x2000, 684 En_CLR = 0x2004, 685 Cfg_CLR = 0x2008, 686 Cfg1_CLR = 0x200C, 687 If_CLR = 0x2010, 688 Ien_CLR = 0x2014, 689 Status_CLR = 0x2018, 690 Debugstatus_CLR = 0x201C, 691 Offset_CLR = 0x2020, 692 Lock_CLR = 0x2024, 693 694 Ipversion_TGL = 0x3000, 695 En_TGL = 0x3004, 696 Cfg_TGL = 0x3008, 697 Cfg1_TGL = 0x300C, 698 If_TGL = 0x3010, 699 Ien_TGL = 0x3014, 700 Status_TGL = 0x3018, 701 Debugstatus_TGL = 0x301C, 702 Offset_TGL = 0x3020, 703 Lock_TGL = 0x3024, 704 } 705 706 public long Size => 0x4000; 707 708 protected DoubleWordRegisterCollection registers; 709 } 710 }