Variable or signal?

X

Xin Xiao

I'm modeling a cache memory in vhdl. What would be the difference between
using a variable or a signal to model my memory?

type mem_cache is array (range) of lines;

signal cache : mem_cache;

- or -

variable cache : mem_cache;
 
K

KJ

Xin Xiao said:
I'm modeling a cache memory in vhdl. What would be the difference between
using a variable or a signal to model my memory?

type mem_cache is array (range) of lines;

signal cache : mem_cache;

- or -

variable cache : mem_cache;

Functionally there would be no difference at all, if you can write a model
using signals, you can write it using variables.

Using variables runs somewhat faster than using signals because there is
more overhead for the simulator with signals than with variables. Try
writing it both ways and see for yourself. It's not a huge difference
though.

KJ
 
X

Xin Xiao

tank you

KJ said:
Functionally there would be no difference at all, if you can write a model
using signals, you can write it using variables.

Using variables runs somewhat faster than using signals because there is
more overhead for the simulator with signals than with variables. Try
writing it both ways and see for yourself. It's not a huge difference
though.

KJ
 

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

No members online now.

Forum statistics

Threads
474,470
Messages
2,571,809
Members
48,797
Latest member
PeterSimpson
Top