Verilog Question

A

Ann

Could you please explain what the following code does

// HOST Memory Array (written via serial interface)
reg [(REGWIDTH-1):0] HOSTmemory[(REGDEPTH-1):0];

// FPGA Memory Array (written directly by FPGA)
reg [(REGWIDTH-1):0] FPGAmemory[(REGDEPTH-1):0];
//
======================================================================
// Fetch READ value
assign memRD = (memRA[7] == HI)?
FPGAmemory[memRA[(REGLOG2DEPTH-1):0]]:
HOSTmemory[memRA[(REGLOG2DEPTH-1):0]];
//
======================================================================
// HOST Register Write Process
always @ (posedge clk)
begin
if ((memWS == HI) && (memWA[(REGWIDTH-1):REGLOG2DEPTH] == 0) )
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]] <= memWD;
else
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]] <=
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]];
end


I dont understand the "Fetch Read Value" and the "HOST Register Write
Process".
 
M

MikeShepherd564

This group is for VHDL. Verilog is a different language.

Try comp.lang.verilog.
 
J

Jonathan Bromley

Could you please explain what the following code does [...]
I dont understand the "Fetch Read Value" and the
"HOST Register Write Process".

As Mike Shepherd said, it's Verilog so it will attract
better answers on comp.lang.verilog - but some of us
inhabit both, so here goes.

First, what part of it don't you understand? It looks
like pretty standard Verilog to me.

Secondly, the original author has gotten pretty confused
about parameterization and a few other things. In
particular:

(1) Why, in the middle of code that otherwise has been
carefully parameterized, do we find this condition as
the memory space selector?

(memRA[7] == HI)?

Maybe the number 7 has mystical significance in some
cultures; in mine, it doesn't. Give it a name.

(2) The write process is enabled by some complicated
condition; if that condition is false, we execute the
following code...
else
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]] <=
HOSTmemory[memWA[(REGLOG2DEPTH-1):0]];

Eh? Why is it *ever* a good idea to write "A <= A" ?

(3) Comments. The comments claim ...
// HOST Memory Array (written via serial interface)

but it's fibbing, isn't it? Unless "memWD" is derived
from the serial interface somehow.

~~~~~~~~~~~~~

So, in summary:
a) take it to comp.lang.verilog;
b) be clearer about what you don't understand, please;
c) go back to the author and sanity-check the questions
I posed above.

thanks
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
(e-mail address removed)
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top