Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
Peripheral Driver Register Configuration
00:00
5 left

Peripheral Driver Register Configuration

HardPython

Problem

Given a hardware register map, write a driver snippet to configure a peripheral in Intuitive embedded systems.

Implement the function below. Return dependency-ordered (address, value) writes, preserving unspecified reset bits and rejecting invalid field values, read-only fields, overlapping masks, unknown fields, duplicate addresses, or dependency cycles. Each register contains name, address, reset, width, fields, and optional after; each field contains name, mask, shift, and access (rw, ro, or w1c). settings maps register names to requested field values. Return None for invalid input.

Constraints

  • 1 <= len(register_map) <= 10^4
  • 1 <= width <= 64
  • Register addresses and names are expected to be integers and strings respectively
  • Field masks are positive integers within the register width
  • Field masks within one register must be non-overlapping and contiguous after shifting
  • Each dependency names a register in register_map
  • settings contains zero or more configured fields per register

Function Signature

def configure_peripheral(register_map, settings):
Interviewer

Your question is Peripheral Driver Register Configuration. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
Code
Sign up free to run your codeLog inLn 2
Run your code to see test output here.