Generating sinwave from array of real










0















I want to generate sinewave from array of real.



Here is array with 12 samples of sine



type memory_type is array (0 to 11) of real;
signal sine : memory_type :=0.50,0.7,0.95,0.99,0.88,0.64,0.36,0.12,0.01,0.05,0.23,0.50);


and i signal for iterations:



signal i : integer range 0 to 10 :=0;


Here is the process which generates 2kHz wave based on samples



process(clk_2kHz)
begin
if (rst = '1') then
i <= 0;
elsif(rising_edge(clk_2kHz)) then
dataout <= sine(i);
i <= i + 1;
if (i = 11) then
i<= 0;
end if;
end if;
end process;


I want to pass this signal to LTC2624 on spartan-3E and get analog sine on output.



Problem is that i am gettin this error:



Line 94: Indexed name is not a integer


Why is this happening? I know that array contains real values but index number is integer(i think). I tried change i to real but it did not help.
Any sugestions?










share|improve this question



















  • 1





    The only place we see in your snippet with an indexed name is sine(unsigned(i)); where the i is an integer and is not closely related to the array type unsigned and ineligible for a type conversion that you don't need anyway. The index type of memory_type is integer, the range is constrained and these match the declaration for i. Also note your test should be if i = 10 then i <= 0; else i <= i + 1; end if; including the increment. Your present test will get a bounds check error when simulating. Signal updates don't occur during process execution. Reals don't synthesize.

    – user1155120
    Nov 16 '18 at 3:32











  • unsigned(i) was posted here by mistake. I was checking if this would help but it not and i forgot to remove it before asking this question. Sorry about that. So if real don't sythesize - How should i represent sample data?

    – eredin
    Nov 16 '18 at 19:06












  • An LTC2624 has a 12 bit representation. Convert your samples to a binary representation with that accuracy.

    – user1155120
    Nov 16 '18 at 20:09















0















I want to generate sinewave from array of real.



Here is array with 12 samples of sine



type memory_type is array (0 to 11) of real;
signal sine : memory_type :=0.50,0.7,0.95,0.99,0.88,0.64,0.36,0.12,0.01,0.05,0.23,0.50);


and i signal for iterations:



signal i : integer range 0 to 10 :=0;


Here is the process which generates 2kHz wave based on samples



process(clk_2kHz)
begin
if (rst = '1') then
i <= 0;
elsif(rising_edge(clk_2kHz)) then
dataout <= sine(i);
i <= i + 1;
if (i = 11) then
i<= 0;
end if;
end if;
end process;


I want to pass this signal to LTC2624 on spartan-3E and get analog sine on output.



Problem is that i am gettin this error:



Line 94: Indexed name is not a integer


Why is this happening? I know that array contains real values but index number is integer(i think). I tried change i to real but it did not help.
Any sugestions?










share|improve this question



















  • 1





    The only place we see in your snippet with an indexed name is sine(unsigned(i)); where the i is an integer and is not closely related to the array type unsigned and ineligible for a type conversion that you don't need anyway. The index type of memory_type is integer, the range is constrained and these match the declaration for i. Also note your test should be if i = 10 then i <= 0; else i <= i + 1; end if; including the increment. Your present test will get a bounds check error when simulating. Signal updates don't occur during process execution. Reals don't synthesize.

    – user1155120
    Nov 16 '18 at 3:32











  • unsigned(i) was posted here by mistake. I was checking if this would help but it not and i forgot to remove it before asking this question. Sorry about that. So if real don't sythesize - How should i represent sample data?

    – eredin
    Nov 16 '18 at 19:06












  • An LTC2624 has a 12 bit representation. Convert your samples to a binary representation with that accuracy.

    – user1155120
    Nov 16 '18 at 20:09













0












0








0


0






I want to generate sinewave from array of real.



Here is array with 12 samples of sine



type memory_type is array (0 to 11) of real;
signal sine : memory_type :=0.50,0.7,0.95,0.99,0.88,0.64,0.36,0.12,0.01,0.05,0.23,0.50);


and i signal for iterations:



signal i : integer range 0 to 10 :=0;


Here is the process which generates 2kHz wave based on samples



process(clk_2kHz)
begin
if (rst = '1') then
i <= 0;
elsif(rising_edge(clk_2kHz)) then
dataout <= sine(i);
i <= i + 1;
if (i = 11) then
i<= 0;
end if;
end if;
end process;


I want to pass this signal to LTC2624 on spartan-3E and get analog sine on output.



Problem is that i am gettin this error:



Line 94: Indexed name is not a integer


Why is this happening? I know that array contains real values but index number is integer(i think). I tried change i to real but it did not help.
Any sugestions?










share|improve this question
















I want to generate sinewave from array of real.



Here is array with 12 samples of sine



type memory_type is array (0 to 11) of real;
signal sine : memory_type :=0.50,0.7,0.95,0.99,0.88,0.64,0.36,0.12,0.01,0.05,0.23,0.50);


and i signal for iterations:



signal i : integer range 0 to 10 :=0;


Here is the process which generates 2kHz wave based on samples



process(clk_2kHz)
begin
if (rst = '1') then
i <= 0;
elsif(rising_edge(clk_2kHz)) then
dataout <= sine(i);
i <= i + 1;
if (i = 11) then
i<= 0;
end if;
end if;
end process;


I want to pass this signal to LTC2624 on spartan-3E and get analog sine on output.



Problem is that i am gettin this error:



Line 94: Indexed name is not a integer


Why is this happening? I know that array contains real values but index number is integer(i think). I tried change i to real but it did not help.
Any sugestions?







vhdl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 11:00







eredin

















asked Nov 15 '18 at 23:59









eredineredin

53




53







  • 1





    The only place we see in your snippet with an indexed name is sine(unsigned(i)); where the i is an integer and is not closely related to the array type unsigned and ineligible for a type conversion that you don't need anyway. The index type of memory_type is integer, the range is constrained and these match the declaration for i. Also note your test should be if i = 10 then i <= 0; else i <= i + 1; end if; including the increment. Your present test will get a bounds check error when simulating. Signal updates don't occur during process execution. Reals don't synthesize.

    – user1155120
    Nov 16 '18 at 3:32











  • unsigned(i) was posted here by mistake. I was checking if this would help but it not and i forgot to remove it before asking this question. Sorry about that. So if real don't sythesize - How should i represent sample data?

    – eredin
    Nov 16 '18 at 19:06












  • An LTC2624 has a 12 bit representation. Convert your samples to a binary representation with that accuracy.

    – user1155120
    Nov 16 '18 at 20:09












  • 1





    The only place we see in your snippet with an indexed name is sine(unsigned(i)); where the i is an integer and is not closely related to the array type unsigned and ineligible for a type conversion that you don't need anyway. The index type of memory_type is integer, the range is constrained and these match the declaration for i. Also note your test should be if i = 10 then i <= 0; else i <= i + 1; end if; including the increment. Your present test will get a bounds check error when simulating. Signal updates don't occur during process execution. Reals don't synthesize.

    – user1155120
    Nov 16 '18 at 3:32











  • unsigned(i) was posted here by mistake. I was checking if this would help but it not and i forgot to remove it before asking this question. Sorry about that. So if real don't sythesize - How should i represent sample data?

    – eredin
    Nov 16 '18 at 19:06












  • An LTC2624 has a 12 bit representation. Convert your samples to a binary representation with that accuracy.

    – user1155120
    Nov 16 '18 at 20:09







1




1





The only place we see in your snippet with an indexed name is sine(unsigned(i)); where the i is an integer and is not closely related to the array type unsigned and ineligible for a type conversion that you don't need anyway. The index type of memory_type is integer, the range is constrained and these match the declaration for i. Also note your test should be if i = 10 then i <= 0; else i <= i + 1; end if; including the increment. Your present test will get a bounds check error when simulating. Signal updates don't occur during process execution. Reals don't synthesize.

– user1155120
Nov 16 '18 at 3:32





The only place we see in your snippet with an indexed name is sine(unsigned(i)); where the i is an integer and is not closely related to the array type unsigned and ineligible for a type conversion that you don't need anyway. The index type of memory_type is integer, the range is constrained and these match the declaration for i. Also note your test should be if i = 10 then i <= 0; else i <= i + 1; end if; including the increment. Your present test will get a bounds check error when simulating. Signal updates don't occur during process execution. Reals don't synthesize.

– user1155120
Nov 16 '18 at 3:32













unsigned(i) was posted here by mistake. I was checking if this would help but it not and i forgot to remove it before asking this question. Sorry about that. So if real don't sythesize - How should i represent sample data?

– eredin
Nov 16 '18 at 19:06






unsigned(i) was posted here by mistake. I was checking if this would help but it not and i forgot to remove it before asking this question. Sorry about that. So if real don't sythesize - How should i represent sample data?

– eredin
Nov 16 '18 at 19:06














An LTC2624 has a 12 bit representation. Convert your samples to a binary representation with that accuracy.

– user1155120
Nov 16 '18 at 20:09





An LTC2624 has a 12 bit representation. Convert your samples to a binary representation with that accuracy.

– user1155120
Nov 16 '18 at 20:09












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53329544%2fgenerating-sinwave-from-array-of-real%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53329544%2fgenerating-sinwave-from-array-of-real%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

政党