ronyz Posted July 26, 2015 Report Share Posted July 26, 2015 Hi, I have two problems: 1) I tried to implement multiplication constraint based on the one of the examples: struct addr_constraint : public scv_constraint_base { scv_smart_ptr<int> row; scv_smart_ptr<int> col; SCV_CONSTRAINT_CTOR(addr_constraint) { SCV_CONSTRAINT( (row())*(col()) < 50); SCV_CONSTRAINT( col() > 0); } }; When I try to randomize the values, the program keeps running and never stops. What might be the problem? 2) Is there any way to define more complex mathematical constraints? constraints on the square, log, shift, division etc...? Where can I find a list of the supported mathematical operations? Thanks! Quote Link to comment Share on other sites More sharing options...
apfitch Posted July 26, 2015 Report Share Posted July 26, 2015 I think the problem is you have used int. This makes the constraint solver work very hard as you are asking it to search through combinations of 64 bits to find a solution. Try this: struct addr_constraint: public scv_constraint_base { scv_smart_ptr<sc_uint<8> > row; scv_smart_ptr<sc_uint<8> > col; SCV_CONSTRAINT_CTOR(addr_constraint) { SCV_CONSTRAINT( (row() *col()) < 50); SCV_CONSTRAINT( col() > 0 ); } }; Regarding the operators, refer to the document vwg_1_0e.pdf in the docs directory, at the bottom of page 34 and the top of page 35. regards Alan Quote Link to comment Share on other sites More sharing options...
ronyz Posted July 27, 2015 Author Report Share Posted July 27, 2015 Thank you! It resolved the problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.