EmbDev.net

Forum: FPGA, VHDL & Verilog How to code a register that will be written to by 2 hosts


von Ben N. (blipton)


Rate this post
useful
not useful
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?

von FPGA advisor (Guest)


Rate this post
useful
not useful
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 :-)

von Ben N. (blipton)


Rate this post
useful
not useful
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.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Then its easy: the thing you need is called "multiplexer"...

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.