Altera_Forum
Honored Contributor
12 years agoMixed sign math problem
The background: I'm working on QAM modulation from a Cyclone II dev board with a DAC board I made connected to it. Works great as a DDS and everything other than the QAM math.
The main QAM calculation is icos(t)-qsin(t). I implemented sin and cos as lookup tables in a module. The following simulates properly in iverilog:// leaving out standard stuff, only relevant lines shown (full paste at the end)
input signed i; // input values
input signed q;
output dacval; // output to the DAC
wire signed sin; // the values back from the lookup tables
wire signed cos;
reg signed dacfull; // holds the full size value
always @(negedge clk)
begin
dacfull=(i*cos)-(q*sin); // the qam value
dacval=(dacfull/64)+512; // scale down, then add to make positive
end
endmodule Here's the problem: the above simulates great, but when I go to synthesize it with Altera, I get the following at the end: Warning (13410): Pin "dacval" is stuck at GND
Warning (13410): Pin "dacval" is stuck at GND However, if I change the math section above to just: dacval=(sin*4)+512; // multiply to full range, then add to make positive It synthesizes without error, and runs perfectly in hardware (outputting a beautiful sine). I spent hours today fooling with different ways to present the signed+unsigned math, but I can't get the Altera synth to like it. What's the proper way? The sin/cos LUT: http://paste.ubuntu.com/5763310 The IQ mod code: http://paste.ubuntu.com/5763316 Full output from synthesis: http://paste.ubuntu.com/5763317