I'm new to verilog/digital design, so not sure how this is usually done.. I need to write to a register from 2 sources.. in this case, a pci host and a microcontroller Since the clock domains are all different, I can't just have multiple processes writing to the same register.. always @(posedge pciclk or negedge nrst) if pci_wr & pci_addr == 0 cntl_reg = pci_data always @(posedge mcclk or negedge nrst) if mc_wr & mc_addr == 0 cntl_reg = mc_data So how is this typically done?
think of the way how you did that in rad hardware how can two persons access one basket ánd place an apple into it if both occur at unpredictable points of time? write down a strategy onto a paper describing an architecture with can handle this you will need an apple placer, an apple replacer, two pre baskets, two pre basket apple receivers, two pre basket apple placers, one guy who checks for apples in the baskets, and places them into the destination basekt, repplacing the existing apple imagine, that "apple" means the piece of information here for those who are confused about that all: IF YOU CANNOT EVEN DESCIBE A PHYSICAL ARCHITECTURE WICH HANDLES YOUR PROBLEM, THEN FPGA DESIGN IS NOTHING FOR YOU :-)
Not sure if this changes things, but the 2 will never access the register at the same time. Basically once the PCI is done , it hands it over the other host, which will then have exclusive access.
Then its easy: the thing you need is called "multiplexer"...