I have a UVM/system-verilog environment that has 3 agents that are connected by analysis ports to the scoreboard. I am using questa on windows for simulation.
I get the error message:
# UVM_ERROR # 0: uvm_test_top.tx_machine_env.tx_machine_sb.Q_I_in_export [Connection Error] connection count of 0 does not meet required minimum of 1
my monitor:
class qvsat_ib_tx_machine_desc_monitor extends uvm_monitor;
`uvm_component_utils(qvsat_ib_tx_machine_desc_monitor)
uvm_analysis_port#(qvsat_ib_tx_machine_desc_item) qvsat_ib_tx_machine_desc_ap;
virtual qvsat_ib_tx_machine_desc_if tx_machine_desc_if;
//Constructor
function new(string name = "qvsat_ib_tx_machine_desc_monitor", uvm_component parent);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
qvsat_ib_tx_machine_desc_ap = new(.name("qvsat_ib_tx_machine_desc_ap"), .parent(this));
endfunction: build_phase
task run_phase(uvm_phase phase);
.
.
.
endtask
endclass
my agent:
class qvsat_ib_tx_machine_desc_agent extends uvm_agent ;
`uvm_component_utils(qvsat_ib_tx_machine_desc_agent)
uvm_analysis_port#(qvsat_ib_tx_machine_desc_item) tx_machine_desc_ap;
qvsat_ib_tx_machine_desc_sequencer tx_machine_seqr;
qvsat_ib_tx_machine_desc_driver tx_machine_driver;
qvsat_ib_tx_machine_desc_monitor tx_machine_monitor;
qvsat_ib_tx_machine_desc_agent_config cfg;
//Constructor
function new(string name = "qvsat_ib_tx_machine_desc_agent", uvm_component parent);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
uvm_report_info(get_full_name(),"START of build ",UVM_LOW);
super.build_phase(phase);
if ( ! uvm_config_db#( qvsat_ib_tx_machine_desc_agent_config )::get
( .cntxt( this ), .inst_name( "" ), .field_name( "desc_cfg" ), .value( cfg ) ) ) begin
`uvm_error( "qvsat_ib_tx_machine_desc_agent", "cfg not found" )
end
tx_machine_desc_ap = new(.name("tx_machine_desc_ap"), .parent(this));
.
.
.
tx_machine_monitor = qvsat_ib_tx_machine_desc_monitor::type_id::create(.name("tx_machine_monitor"), .parent(this));
uvm_report_info(get_full_name(),"END of build ",UVM_LOW);
endfunction: build_phase
function void connect_phase(uvm_phase phase);
uvm_report_info(get_full_name(),"START of connect ",UVM_LOW);
super.connect_phase(phase);
.
.
.
uvm_report_info(get_full_name(),"connecting analysis ports",UVM_HIGH);
tx_machine_monitor.qvsat_ib_tx_machine_desc_ap.connect(tx_machine_desc_ap);
uvm_report_info(get_full_name(),"END of connect ",UVM_LOW);
endfunction: connect_phase
endclass
my envir:
class qvsat_ib_tx_machine_env extends uvm_env;
`uvm_component_utils(qvsat_ib_tx_machine_env)
qvsat_ib_tx_machine_desc_agent tx_machine_desc_agent ;
qvsat_ib_tx_machine_sb tx_machine_sb;
qvsat_ib_tx_machine_env_config env_cfg ;
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction: new
function void build_phase(uvm_phase phase);
uvm_report_info(get_full_name(),"START of build ",UVM_LOW);
super.build_phase(phase);
tx_machine_desc_agent = qvsat_ib_tx_machine_desc_agent::type_id::create(.name("tx_machine_desc_agent"), .parent(this));
uvm_report_info(get_full_name(),"END of build ",UVM_LOW);
endfunction: build_phase
function void connect_phase(uvm_phase phase);
uvm_report_info(get_full_name(),"START of connect ",UVM_LOW);
super.connect_phase(phase);
if(env_cfg.scoreboard_en == 1'b1) begin
tx_machine_desc_agent.tx_machine_desc_ap.connect(tx_machine_sb.desc_export);
end
uvm_report_info(get_full_name(),"END of connect ",UVM_LOW);
endfunction: connect_phase
endclass: qvsat_ib_tx_machine_env
my scoreboard:
`uvm_analysis_imp_decl(_desc )
class qvsat_ib_tx_machine_sb extends uvm_scoreboard;
`uvm_component_utils(qvsat_ib_tx_machine_sb)
uvm_analysis_export #(qvsat_ib_tx_machine_desc_item) desc_export ;
qvsat_ib_tx_machine_desc_item cur_desc;
function new(string name, uvm_component parent);
super.new(name, parent);
uw_cnt = 0;
uw_simbole_cnt = 0;
data_cnt = 0;
pilot_simbole_cnt = 0;
state = IDLE;
endfunction : new
function void build_phase(uvm_phase phase);
super.build_phase(phase);
desc_export = new("desc_export", this);
endfunction: build_phase
virtual function void write_desc(input qvsat_ib_tx_machine_desc_item desc);
cur_desc = desc;
cur_desc.print();
endfunction : write_desc
.
.
.
endclass
Note: I have 2 more agents that are connected to the scoreboard by another 2 different analysis ports, and I get the same error message for all of them.
How can I fix this error?
I did the following change that solved that problem:
instead of
uvm_analysis_export #(qvsat_ib_tx_machine_desc_item) desc_export ;
I used:
uvm_analysis_imp_desc #(qvsat_ib_tx_machine_desc_item,qvsat_ib_tx_machine_sb) desc_export ;
i.e
uvm_analysis_imp< `uvm_analysis_imp_decl name >
regards,
Ilan
Related
I'm trying to test some procedure I have made with the code given by Neo4j for testing procedure. However my procedure is based on the results from the random walk algorithm which I have to call through 'algo.randomWalk.stream()'.
To do so, I'm instantiating a Neo4j test server. However it doesn't recognize the algo.randomWalk.stream(), because I think it doesn't have the algorithm package in its plugins.
This is the code I'm working on
package example;
import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Rule;
import org.junit.Test;
import org.neo4j.driver.v1.*;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import static org.neo4j.driver.v1.Values.parameters;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import org.neo4j.harness.junit.Neo4jRule;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.*;
import static org.neo4j.driver.v1.Values.parameters;
public class ScoringTest {
// This rule starts a Neo4j instance for us
#Rule
public Neo4jRule neo4j = new Neo4jRule()
// This is the Procedure we want to test
.withProcedure( Scoring.class );
//org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.examples.server.unmanaged=/examples/unmanaged
#Test
public void shouldAllowReturningTheLastValue() throws Throwable
{
// This is in a try-block, to make sure we close the driver after the test
try( Driver driver = GraphDatabase
.driver( neo4j.boltURI() , Config.build().withEncryptionLevel( Config.EncryptionLevel.NONE ).toConfig() ) )
{
System.out.println(neo4j.boltURI().toString());
// Given
neo4j.withExtension(neo4j.boltURI().toString(), "..\\graph-algorithms-algo-3.5.4.0.jar");
Session session = driver.session();
String PATH = "..\\data\\data.json";
File JSON_SOURCE = new File(PATH);
List<HashMap<String,Object>> mss = new ObjectMapper().readValue(JSON_SOURCE, List.class);
session.run("UNWIND {bulk} as row " +
"CREATE (n:Users) " +
"SET n += row.properties", parameters("bulk", mss ));
for(int k = 0; k<9; k++) {
PATH = "..\\data\\"+k+".json";
mss = new ObjectMapper().readValue(JSON_SOURCE, List.class);
JSON_SOURCE = new File(PATH);
session.run("UNWIND {bulk} as row " +
"MATCH (from:Users), (to:Clips) " +
"WHERE ID(from) = toInt(row.from) AND ID(to) = toInt(row.to._key) " +
"CREATE (from)-[rel:hasClipped]->(to) " +
"SET rel += row.properties ", parameters("bulk", mss ));
}
// When
Value result = session.run( "MATCH (n:Clips) WHERE ID(n) = 1038 " +
"CALL algo.randomWalk.stream(ID(n), 2, 1) " +
"YIELD nodeIds " +
"UNWIND nodeIds as nodeId " +
"MATCH (l:Clips)-[r:hasClipped]-(q:Users) " +
"WHERE (ID(l) = nodeId) AND (ID(q) in nodeIds) " +
"WITH collect({relation:r,Clip:l,User:q}) as res " +
"RETURN res").single().get("res");
System.out.println(result);
// Then
assertThat( result, equalTo( 0L ) );
}
}
}
The exact error that I get is : org.neo4j.driver.v1.exceptions.ClientException: There is no procedure with the name algo.randomWalk.stream registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.
Thanks for your time and your future answers,
Syndorik
So I found out a solution for this issue.
There's an option for Neo4jRule object that allows you to change the path to the plugin directory.
For instance, I've just added this config to Neo4jRule and then could call the graphalgo library :
public Neo4jRule neo4j = new Neo4jRule()
// This is the Procedure we want to test
.withProcedure( Scoring.class )
.withConfig(GraphDatabaseSettings.plugin_dir, "PATH_TO_PLUGIN_DIR")
.withConfig(GraphDatabaseSettings.procedure_unrestricted, "algo.*" );
1) My Environment:
. Windows 10 Pro (licensed) - 64 bits - 8GB Ram;
. AutoCAD (licensed) 2014/2015/2016/2017 64 bits (all HOTFIX and SERVICEPACK installed);
. Visual Studio 2010 Express Edition (for AutoCAD 2014);
. Visual Studio 2013 (for AutoCAD 2015/2016/2017);
. Antivirus : only Windows Defender.
2) Visual Studio 2013 Solution
nuGet packages:
System.Data.SQLite
SpatialiteSharp
Target: .NET 4.5
3) Database used for this test
. Database name : 'dbtest.sqlite', download here and save to c:\temp
. Database table : 'tb_test'
. Database table tb_test fields:
featureName : TEXT
geometry : POLYGON
4) Code Running on AutoCAD 2015 : OK
In Visual Lisp, I call dbQuery .NET method (file MyCommands.cs):
(setq result_query (dbQuery))
and will return a list:
[0] "FeatureName=first test area , MinX=101.23 , MinY=101.5 , MaxX=215.7 , MaxY=201.953 , Area=5532.771185"
[1] "FeatureName=second test area , MinX=100 , MinY=50 , MaxX=200 , MaxY=100 , Area=5000"
5) P R O B L E M :: Code running on Autocad 2016/2017 ::
Error : "Autodesk application has stopped working"
My plugin run ok on AutoCAD 2014 (.NET 4.0) and AutoCAD 2015 (.NET 4.5), but don't running on AutoCAD 2016/2017.
The code is the same, but changed only AcMgd/AcCoreMgd/AcDbMgd and Target DotNet Framework.
When debug my plugin, crash occurs on
connection.LoadExtension("mod_spatialite");
Then I receive a AutoCAD crash message window, saying:
Autodesk applicaton has stopped working
6) My AutoCAD 2017 plugin code
clique here to download VisualStudio 2013 "AutoCAD2017SpatialiteTest" Solution
MyCommands.cs code
// Test (System.Data.SQLite + SpatialiteSharp) in AutoCAD 2017 plugin
// Date: March, 7, 2017.
//
//==============================================================
using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
using System.Data.SQLite;
using SpatialiteSharp;
using System.IO;
using System.Reflection;
// This line is not mandatory, but improves loading performances
[assembly: CommandClass ( typeof ( AutoCAD2017SpatialiteTest.MyCommands ) )]
namespace AutoCAD2017SpatialiteTest
{
// This class is instantiated by AutoCAD for each document when
// a command is called by the user the first time in the context
// of a given document. In other words, non static data in this class
// is implicitly per-document!
public class MyCommands
{
private static readonly object Lock = new object ();
private static bool _haveSetPath;
//*******************************************************************
// LispFunction is similar to CommandMethod but it creates a lisp
// callable function. Many return types are supported not just string
// or integer.
//
//
//
[LispFunction ( "dbQuery", "dbQuery" )]
public ResultBuffer dbQuery ( ResultBuffer args ) // This method can have any name
{
try
{
// Create Spatialite SQL Connection
//
string databaseName = #"c:\temp\dbtest.sqlite";
string connectString = #"Data Source=" + databaseName + ";Version=3;";
SQLiteConnection connection = new SQLiteConnection ( connectString );
/// Open the database and load in the Spatialite extension
connection.Open ();
/// Loads mod_spatialite.dll on the given connection
///
lock ( Lock )
{
//Need to work out where the file is and add it to the path so it can load all the other dlls too
if ( !_haveSetPath )
{
var spatialitePath = Path.Combine ( Path.GetDirectoryName ( Assembly.GetExecutingAssembly ().Location ), (Environment.Is64BitProcess ? "x64" : "x86"), "spatialite" );
Environment.SetEnvironmentVariable ( "PATH", spatialitePath + ";" + Environment.GetEnvironmentVariable ( "PATH" ) );
_haveSetPath = true;
}
}
connection.EnableExtensions ( true );
connection.LoadExtension ( "mod_spatialite" );
// Make some Spatialite function calls
string sql = "SELECT featureName, ST_MINX(geometry), ST_MINY(geometry), ST_MAXX(geometry), ST_MAXY(geometry), ST_AREA(geometry) FROM tb_test ";
double minX = 0.0, minY = 0.0, maxX = 0.0, maxY = 0.0, area = 0.0;
string featureName = "";
string result_query = "";
// initialize resBuf list
//
ResultBuffer resBufCatch = new ResultBuffer ();
resBufCatch.Add ( new TypedValue ( (int)LispDataType.ListBegin ) );
// execute sql query
//
using ( SQLiteCommand command = new SQLiteCommand ( sql, connection ) )
{
using ( SQLiteDataReader reader = command.ExecuteReader () )
{
while ( reader.Read () )
{
featureName = reader.GetString ( 0 );
minX = reader.GetDouble ( 1 );
minY = reader.GetDouble ( 2 );
maxX = reader.GetDouble ( 3 );
maxY = reader.GetDouble ( 4 );
area = reader.GetDouble ( 5 );
// define string with fields values from 'tb_test'
//
result_query = String.Format ( "FeatureName={0} , MinX={1} , MinY={2} , MaxX={3} , MaxY={4} , Area={5}", featureName, minX.ToString (), minY.ToString (), maxX.ToString (), maxY.ToString (), area );
// add result_query to buffer
//
resBufCatch.Add ( new TypedValue ( (int)LispDataType.Text, result_query ) );
}
}
}
// finalize resBuf list
//
resBufCatch.Add ( new TypedValue ( (int)LispDataType.ListEnd ) );
// Close and clean up the database connection
//
connection.Close ();
connection.Dispose ();
// return result_query value to lisp function...
//
return resBufCatch;
}
catch ( System.Exception ex )
{
string exception_message = String.Format ( "Error : {0}", ex.Message );
ResultBuffer resBufCatch = new ResultBuffer ();
resBufCatch.Add ( new TypedValue ( (int)LispDataType.Text, exception_message ) );
return resBufCatch;
}
}
}
}
7) Question
Anybody help me run this AutoCAD2017 plugin?
Thank you very much.
Do you have an error report dialog like this one after the crash?
If yes, don't close the dialog and go to the folder C:\Users\\AppData\Local\Temp (%temp%). There must be a file named dumpdata.zip. In the archive, there is an xml file which can give you more details on the error and a .dmp file you can open in Visual Studio.
0i want to traversal using neo4j.
while it give me the output from newno1 like
(4354)
(4354)--[KNOWS,8335]-->(4358)
(4354)--[KNOWS,8335]-->(4358)--[KNOWS,8332]-->(4357)
(4354)--[KNOWS,8334]-->(4356)
why it didn't give me right node number from 0-4? and depth is from 1-3
thanks.
i just want to traversal in this graph like level by level and output the backward and forward separately.
The expected output should be like:
(1)
(1)--[KNOWS,0]-->(2)
(1)--[KNOWS,0]-->(2)--[KNOWS,2]-->(2)
(1)--[KNOWS,0]-->(4)
the number after KNOWS should also like smaller number. like neo4j example
the java code is :
public class TraversalExample
{
private GraphDatabaseService db;
private TraversalDescription friendsTraversal;
public TraversalExample( GraphDatabaseService db )
{
this.db = db;
// START SNIPPET: basetraverser
friendsTraversal = db.traversalDescription()
.depthFirst()
.relationships( Rels.KNOWS )
.uniqueness( Uniqueness.RELATIONSHIP_GLOBAL );
// END SNIPPET: basetraverser
}
public static void main( String[] args )
{
final String DB_PATH = "target/neo4j-hello-db";
GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH);
TraversalExample op = new TraversalExample( db );
op.createTheGraph();
op.shutdownGraph();
}
public void shutdownGraph()
{
try
{
if ( db != null )
{
db.shutdown();
}
}
finally
{
db = null;
}
}
public Node createTheGraph()
{
try ( Transaction tx = db.beginTx() )
{
// START SNIPPET: createGraph
Node[] newno=new Node[5];
for(int i=0; i<newno.length; i++){
newno[i]=db.createNode();
}
newno[1].createRelationshipTo(newno[2], Rels.KNOWS );
newno[1].createRelationshipTo(newno[4], Rels.KNOWS );
newno[4].createRelationshipTo(newno[2], Rels.KNOWS );
newno[2].createRelationshipTo(newno[3], Rels.KNOWS );
System.out.println(knowsTraverserforward(newno[1]));
return newno[1];
}
}
public String knowsLikesTraverser( Node node )
{
String output = "";
// START SNIPPET: knowslikestraverser
for ( Path position : db.traversalDescription()
.depthFirst()
.relationships( Rels.KNOWS )
.relationships( Rels.LIKES, Direction.INCOMING )
.evaluator( Evaluators.toDepth( 5 ) )
.traverse( node ) )
{
output += position + "\n";
}
// END SNIPPET: knowslikestraverser
return output;
}
public String knowsTraverserforward( Node node )
{
String output = "";
// START SNIPPET: knowslikestraverser
for ( Path position : db.traversalDescription()
.depthFirst()
.relationships( Rels.KNOWS, Direction.OUTGOING )
.evaluator( Evaluators.toDepth(5 ) )
.traverse( node ) )
{
output += position + "\n";
}
// END SNIPPET: knowslikestraverser
return output;
}
public String traverseBaseTraverser( Node node )
{
String output = "";
// START SNIPPET: traversebasetraverser
for ( Path path : friendsTraversal.traverse( node ) )
{
output += path + "\n";
}
// END SNIPPET: traversebasetraverser
return output;
}
public String depth3( Node node )
{
String output = "";
// START SNIPPET: depth3
for ( Path path : friendsTraversal
.evaluator( Evaluators.toDepth( 3 ) )
.traverse( node ) )
{
output += path + "\n";
}
// END SNIPPET: depth3
return output;
}
public String depth4( Node node )
{
String output = "";
// START SNIPPET: depth4
for ( Path path : friendsTraversal
.evaluator( Evaluators.fromDepth( 2 ) )
.evaluator( Evaluators.toDepth( 4 ) )
.traverse( node ) )
{
output += path + "\n";
}
// END SNIPPET: depth4
return output;
}
public String nodes( Node node )
{
String output = "";
// START SNIPPET: nodes
for ( Node currentNode : friendsTraversal
.traverse( node )
.nodes() )
{
output += currentNode.getProperty( "name" ) + "\n";
}
// END SNIPPET: nodes
return output;
}
public String relationships( Node node )
{
String output = "";
// START SNIPPET: relationships
for ( Relationship relationship : friendsTraversal
.traverse( node )
.relationships() )
{
output += relationship.getType().name() + "\n";
}
// END SNIPPET: relationships
return output;
}
// START SNIPPET: sourceRels
private enum Rels implements RelationshipType
{
LIKES, KNOWS
}
// END SNIPPET: sourceRels
}
The internal node id of any node is a implementation detail. You should not take any assumptions on the node id.
I guess if you print the node id of the nodes being created they would pretty much with your traversal:
for(int i=0; i<newno.length; i++){
newno[i]=db.createNode();
System.out.println(newno[i].getId());
}
I have a script with using a lot of Magic method __call.
The script have 15 000 iterance and the object is bigger.
After every iterance the memory grows. I use unset or $val = null; but the memory continues to grow.
What can i do?
An Exemple :
$data = null;
foreach ($field['method']['actions'] as $action) {
// si l'action ne concerne pas le name space principal
if (!array_key_exists('get', $action)) {
continue;
}
if (array_key_exists('begin', $action)) {
$data .= $action['begin'];
}
if (array_key_exists('action', $action)) {
$obj = $notice->__call('get' . ucfirst($action['action']));
$notice->clear();
if (is_object($obj)) {
$rsl = $obj->__call('get' . ucfirst($action['get']));
$obj->clear();
echo "\n" . 'get' . ucfirst($action['get']) . ' : ' . number_format(memory_get_usage());
$data .= $rsl;
unset($rsl);
} else {
$data .='';
}
$obj = null;
} else {
$data .= $notice->__call('get' . ucfirst($action['get']));
$notice->clear();
echo "\n" . 'get' . ucfirst($action['get']) . ' : ' . number_format(memory_get_usage());
}
if (array_key_exists('end', $action)) {
$data .= $action['end'];
}
}
//--
class Notice{
//--
protected $instanceObj = null;
public function __call($name, $arguments = null) {
$this->instanceObj = $this->$name($arguments);
return $this->instanceObj;
}
public function clear(){
$this->instanceObj = null;
}
//--
}
An exemple of log file :
getField : 24,446,752
getField : 24,447,352
getField : 24,447,720
getField : 24,448,096
getField : 24,483,320
getField : 24,483,336
getField : 24,483,728
...
getField : 25,267,936
...
getField : 35,596,712
...
You can see the memory never stop to brows.
The only solution is to sequence the script several execution. The problem is not PHP Symfony but generates too many objects. So I run the script Pacquet x. Otherwise it led to a saturation of memory.
I need to store a Lua function using the library "Simple Lua Binder"
typedef ? TLuaFunction;
class Foo
{
public:
void SetCallback( TLuaFunction f )
{
mCallback = f;
}
void ExecuteCallback()
{
f(); // Calls Lua function
}
private:
TLuaFunction mCallback;
};
// Manager initialization
SLB::Manager scriptManager;
// SetCallback registration into lua
SLB::Class<Foo>( "Foo", &scriptManager )
.constructor()
.set( "SetCallback", &Foo::SetCallback )
.set( "ExecuteCallback", &Foo::ExecuteCallback )
;
char* luaCode =
"SLB.using( SLB )\n"
"o = Foo()\n"
"o:SetCallback( function() \n"
" print( 'Callback executed' ) \n"
" end \n"
") \n"
"o:ExecuteCallback() \n";
SLB::Script script( &scriptManager );
script.doString( luaCode );
// The result is
> "Callback executed"
I don't know if there is a type in SLB library that I can put instead of ? ( see the first line of code ).
Or if I have to do the things different.