• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. Instantiate SystemC module in SystemVerilog module with...

Stats

  • Locked Locked
  • Replies 0
  • Subscribers 65
  • Views 4166
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Instantiate SystemC module in SystemVerilog module with real/double ports

coderoo
coderoo over 5 years ago

I would like to instantiate a SystemC module inside a SystemVerilog module with real/double ports.

Here is some source code:

// file model.h:
#include "systemc.h"
class model : public sc_module {
public:
sc_in <double> inval;
sc_out<double> outval;
SC_CTOR(model) : inval("inval"), outval("outval") {
SC_METHOD(run);
sensitive << inval;
}
void run() {
outval.write(inval.read());
}
};
// file model.cpp:
#include "model.h"
XMSC_MODULE_EXPORT(model)
// file model.sv:
module model (inval, outval )
(* integer foreign = "SystemC";
*);
input var real inval;
output var real outval;
endmodule
// top.sv:
module top;
real inval;
real outval;
initial begin
inval = 2'b0;
#10 inval = 1.0;
#10 inval = 2.0;
#10 $finish;
end
model test (inval, outval);
endmodule

Here is the command to compile and run:
xrun -sysv top.sv model.sv -sysc model.cpp -top top

I get an error:
input var real inval;
|
xmelab: *F,SCVREG (./model.sv,17|21): Found a Verilog output register in the shell 'model'.

If I change the port types to [1:0]/sc_uint<2>, everything works.

How can I connect real/double ports without having to resort to $realtobits, etc.

Thank you.


  • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information