Try to make a function generator by using DPI sin functions from C, however, error occurredthis is my whole sv code package math_pkg; //import dpi task C Name = SV function name import "DPI-C" pure function real cos (input real rTheta); import "DPI-C" pure function real sin (input real rTheta); import "DPI-C" pure function real log (input real rVal); import "DPI-C" pure function real log10 (input real rVal); endpackage : math_pkg Error (10170): Verilog HDL syntax error at math_pkg.sv(3) near text ""DPI-C"; expecting an identifier what the heck is going on dude ??
--- Quote Start --- DPI is for simulation, not for synthesis. --- Quote End --- Thank you for replying I wonder why this is synthesis not simulation Is there a way that I can use sine functions for synthesis in fpga? then how to create a function generator with C languages ? thankyou!
--- Quote Start --- https://pdfs.semanticscholar.org/f523/c638e72ce7a9b068470510ba54d23bf715fb.pdf --- Quote End --- Thank you so much! this helps me a lot! , :) Can I also ask a question the input/output declaration for a module? for example module slc3( input logic [15:0] S, input logic Clk, Reset, Run, Continue, output logic [11:0] LED, output logic [6:0] HEX0, HEX1, HEX2, HEX3, output logic CE, UB, LB, OE, WE, output logic [19:0] ADDR, inout wire [15:0] Data //tristate buffers need to be of type wire ); i see that all the input output are calculated in a binary form,
However , the input from the article suggestests a fraction number(like 0.45) https://alteraforum.com/forum/attachment.php?attachmentid=13710&stc=1 if the result from sine wave is, for example, -0.52, should i express this in binary for the module 's output? and datatype of the output be like?(logic, real....) thanks!