EmbDev.net

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


Author: Ben Nguyen (blipton)
Posted on:

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

Author: FPGA advisor (Guest)
Posted on:

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

Author: Ben Nguyen (blipton)
Posted on:

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

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.