procedure inside package body and modelsim error
by Olaf Petzold » Fri, 13 Apr 2007 04:14:58 GMT
Hi,
I try to move out some stuff for use with testbenches. Anyway, I wote:
---8<---
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
package tb_pkg is
procedure tic(clk : in time);
end package tb_pkg;
package body tb_pkg is
procedure tic(clk: in time) is
begin
wait until rising_edge(clk); -- line73
end procedure;
end package body tb_pkg;
--->8--
modelsim got:
# ** Error: ../source/vhdl/tb_pkg.vhd(73): No feasible entries for
subprogram "rising_edge".
# ** Warning: [2] ../source/vhdl/tb_pkg.vhd(73): Wait statement has no
sensitivity list or time out clause.
Mmhh, this happens only by use with the package. How to get it working
and what is the reason for? It's inspired by
http://www.**--****.com/ ~mike_treseler/test_uart.vhd ;-)
Thanks
Olaf
Re: procedure inside package body and modelsim error
by Jonathan Bromley » Fri, 13 Apr 2007 06:45:11 GMT
I suspect your "clk" should be of type "std_logic", not "time".
Now I'm sure! TWO things wrong here:
(1) there's no rising_edge function for "time", unless you
wrote it yourself. Let's assume that you meant "std_logic".
(2) rising_edge needs a *signal* to work on, because
it needs to test the signal's 'event attribute. You are
giving it a *constant*, the procedure's input parameter.
Let's try again... with a tick-count parameter for
added versatility...
package tb_pkg is
procedure tic(signal clk: in std_logic; N: in positive := 1);
end package;
package body tb_pkg is
procedure tic(signal clk: in std_logic; N: in positive := 1) is
begin
for i in 1 to N loop wait until rising_edge(clk); end loop;
end;
end package;
Should be OK now :-)
Presumably it worked when you had the procedure in a process,
because you didn't pass "clk" as a parameter, but used it directly?
--
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
XXXX@XXXXX.COM
http://www.**--****.com/
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Re: procedure inside package body and modelsim error
by Mike Treseler » Fri, 13 Apr 2007 06:50:12 GMT
Add the clock to your sim package like this:
signal clk_s : std_ulogic := '0'; --
procedure tic; --
wait until rising_edge(clk_s); --
Also see the "Remote Testbench Procedure"
-- Mike Treseler
Re: procedure inside package body and modelsim error
by Andy Peters » Fri, 13 Apr 2007 07:25:17 GMT
You need to put another set of library/use clauses before the package
body declaration.
-a
Re: procedure inside package body and modelsim error
by kennheinrich » Fri, 13 Apr 2007 07:31:49 GMT
Olaf,
One problem is that 'time' doesn't have rising edges (as meant by the
rising_edge function: a change which brings the signal to a value of
'1'). Time is just an integer range. Logic signals have rising
edges. I suspect that you either want to define clk as std_logic, or
(for simulation) change your procedure to wait until time >
some_next_value_of_time.
- Kenn
Similar Threads:
1.Main procedure inside a package?
Hello,
Is it possible for the main procedure to be inside a package? The
compiler is GNAT.
2.fphdl package compilation error in Modelsim
3.# inside a macro body
Hello All,
We're using in-house C pre processor for Assembly development.
We'd like to move to a standard "C" pre processor (such as gcc's "cpp").
However we have the following problem:
Out assembly code have the following syntax:
move #2, d1;
How can I write a macro that will produce the above line?
If I try:
#define mv(reg) move #2, reg;
I get (for cpp -E):
f:1:23: '#' is not followed by a macro parameter
I've tried with ## and \# but it doesn't work.
Is there a way around this?
Thanks.
Miki
4.Importing variables from Main Expect Body to Procedures
After much Google searching and wasting time, I am still stuck on a
fairly simple problem. I have written an expect script in which the
lindex function is used to receive a password from the outside but
then I got fancy and am trying to import it in to a procedure. The
manual says that all variables are local unless you use the global
designation which I did with no effect at all. Here is a
stripped-down example of the script. The complaint from expect -d is
that the variable pw can't be read.
#!/usr/local/bin/expect -f
#Pick up first argument as password.
set pw [lindex $argv 0]
#This has the proper value anywhere in the main body.
#Feed it to proc login.
proc login { } {
send "$pw\r"
expect {
-exact "ord" {
send -- ""
expect -exact "\$"
send -- "exit\r"
expect eof
exit 1
}
-exact "\$" {
return
}
}
}
I did try
global pw
and occupied a few more bytes of disk space, but nothing seems to
import that variable into proc login.
The other lines in the script do work if I hard-code the
variable in to the procedure so this little problem is all that
separates me from victory.:-). Any constructive ideas are much
appreciated.
--
Martin McCormick WB5AGZ Stillwater, OK
Information Technology Division Network Operations Group
5.[modelsim] displaying signals from inside components
Hi there,
I wanted to add a signal to default graph I get when I run "Simulate
Behavioral Model" from Xilinx Project Navogator. I ran a test bench in
ModelSim (invoked ModelSim from Xilinx Project Manager), saved the
generated wave.do file and added a line which, as I undestand it, should
add an signal to the graph:
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate -format Logic /rounds_tb_vhd/clk
# more add wave ...
add wave -noupdate -format Literal /rounds_tb_vhd/round
add wave -noupdate -format Literal /rounds_tb_vhd/uut/rnd_n/subkey
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {0 ps} 0}
configure wave -namecolwidth 212
# more configures...
configure wave -timeline 0
update
WaveRestoreZoom {0 ps} {1050 ns}
The signal I added is:
/rounds_tb_vhd/uut/rnd_n/subkey
The only difference between that signal and the rest of signals is that
this one is not from unit under test but from a component inside unit
under test. When I executed my new wave.do, I get a "-No Data-" for
"subkey" signal. What did I do wrong?
--
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"
6. ModelSim Error : "Fatal error in Process determine_phase_shift" during post synthesis of Xilinx vhd
7. Viewing variables within process scoped procedures (Modelsim
8. Viewing variables within process scoped procedures (Modelsim)