J
Joe Vanderwall
Guest
Hi folks,
I am having a problem that is beyound my present VHDL capabilities.
I am trying to model a bus in a testbench using the following
(incomplete) record:
type rec is record
rd, wr, waitreq : std_logic;
writedata : std_logic_vector(31 downto 0);
end record;
(I left a bunch out for brevity).
- rd, wr, and writedata are driven by the master of the bus.
- waitreq is driven by the slave, indicating when it can't immediately
satisfy a master request.
I then have some useful functions having prototypes:
procedure InitBus( signal busRec: inout rec );
procedure WriteValue( signal busRec: inout rec;
address: integer;
value: integer );
And in my code I hook things up:
architecture ...
signal busRec : rec;
...
begin
DUT_inst : DUT port map ( wr=>wr, rd=>rd,
waitreq=>waitreq, readdata=>readdata,
... );
wr <= rec.wr;
rd <= rec.rd;
writedata <= rec.writedata;
rec.waitreq <= waitreq;
InitBus( rec );
end;
This setup causes an error, presumably because some records are driven
from the procedure, and others from the DUT.
How do the "professionals" create and use a record that has some
fields driving one way, and others driving the other?
I've successfully used this arrangement before, but I managed to have
all the fields of the record driven from the procedures. In this case
I now have a waitreq, which is an integral part of the bus model,
driven by the DUT . Is it possible to bring this signal into the
procedures using a single record? Or do things have to get messy?
A further question is when I have a birectional data bus (driven by
the master during writes, driven by the DUT during reads). Example:
begin
DUT_inst: DUT port map ( data => bidir_data ... );
rec.bidir_data <= bidir_data;
end;
Can I even manage bidirection data buses with the record approach?
Can someone suggest further reading on how to do this stuff? An
admittedly cursory Google search brought up all kinds of stuff on
records, but nothing that I could relate to my problem. Obviously,
though, this sort of thing must be done all the time in testbenches,
but I somehow haven't come across. I certainly don't want to manually
write out bus transaction without procedures.
Joe
I am having a problem that is beyound my present VHDL capabilities.
I am trying to model a bus in a testbench using the following
(incomplete) record:
type rec is record
rd, wr, waitreq : std_logic;
writedata : std_logic_vector(31 downto 0);
end record;
(I left a bunch out for brevity).
- rd, wr, and writedata are driven by the master of the bus.
- waitreq is driven by the slave, indicating when it can't immediately
satisfy a master request.
I then have some useful functions having prototypes:
procedure InitBus( signal busRec: inout rec );
procedure WriteValue( signal busRec: inout rec;
address: integer;
value: integer );
And in my code I hook things up:
architecture ...
signal busRec : rec;
...
begin
DUT_inst : DUT port map ( wr=>wr, rd=>rd,
waitreq=>waitreq, readdata=>readdata,
... );
wr <= rec.wr;
rd <= rec.rd;
writedata <= rec.writedata;
rec.waitreq <= waitreq;
InitBus( rec );
end;
This setup causes an error, presumably because some records are driven
from the procedure, and others from the DUT.
How do the "professionals" create and use a record that has some
fields driving one way, and others driving the other?
I've successfully used this arrangement before, but I managed to have
all the fields of the record driven from the procedures. In this case
I now have a waitreq, which is an integral part of the bus model,
driven by the DUT . Is it possible to bring this signal into the
procedures using a single record? Or do things have to get messy?
A further question is when I have a birectional data bus (driven by
the master during writes, driven by the DUT during reads). Example:
begin
DUT_inst: DUT port map ( data => bidir_data ... );
rec.bidir_data <= bidir_data;
end;
Can I even manage bidirection data buses with the record approach?
Can someone suggest further reading on how to do this stuff? An
admittedly cursory Google search brought up all kinds of stuff on
records, but nothing that I could relate to my problem. Obviously,
though, this sort of thing must be done all the time in testbenches,
but I somehow haven't come across. I certainly don't want to manually
write out bus transaction without procedures.
Joe