나는 VHDL과 함께 뮤직 박스를하고있다. 나는 처음으로 A4를 연주했고 나는 성공적이었다.루프 및 vhdl에 롬
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
library UNISIM;
use UNISIM.VComponents.all;
entity Basic is
Port( clk : in STD_LOGIC;
note : out STD_LOGIC;
);
end Basic;
architecture Behavioral of Basic is
signal count : unsigned (15 downto 0) := (others => '0');
begin
note <= std_logic(count(15));
process (clk)
begin
if rising_edge(clk) then
if (count=56817) then
count <= "0000000000000000";
else
count <= count + 1;
end if;
end if;
end process;
end Behavioral;
내 미완성 코드는 롬 값을 변경하려는이
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
library UNISIM;
use UNISIM.VComponents.all;
entity Basic is
Port( clk : in STD_LOGIC;
note : out STD_LOGIC;
address: in integer range 0 to 31
);
end Basic;
architecture Behavioral of Basic is
signal count : unsigned (15 downto 0) := (others => '0');
signal reg_address : integer range 0 to 31 ;
type rom_array is array (0 to 31) of integer (4 downto 0);
constant rom: rom_array := ( "11011", "11011",
"11011", "11011","11011", "11011",
"11011", "11011", "11011", "11011",
"11011", "11011","11011", "11011",
"11011", "11011","11011", "11011",
"11011", "11011","11011", "11011",
"11011", "11011","11011", "11011",
"11011", "11011","11011", "11011",
"11011", "11011");
begin
note <= std_logic(count(15));
process (clk)
begin
if rising_edge(clk) then
reg_address <= address;
if (reg_address < 32) then
if (count = rom(reg_address)) then
count <= "0000000000000000";
else
count <= count + 1;
end if;
else
reg_address <= "00000";
end if;
end if;
reg_address <= reg_address + 1;
end process;
end Behavioral;
같다. 시계를 나누어 소리를 생성하려고합니다. 25mhz/56818 = 440과 비슷합니다. 노래를 재생하려면 시계를 나누는 데 필요한 숫자로 채워진 ROM을 만든 다음 for 루프를 실행하고 노래를 재생하는 방법을 생각했습니다. 하지만 for 루프가 java/C와 유사하지 않기 때문에 나는 이것을 무시할 수 없다고 생각한다.
내 오류는 다음과 같습니다 당신이 유형 엄격해야하므로
ERROR:HDLParsers:526 - "C:/Users/user/DigitalProje/Basic.vhd" Line 18. Non array type integer can not have a index constraint.
ERROR:HDLParsers:3312 - "C:/Users/user/DigitalProje/Basic.vhd" Line 19. Undefined symbol 'rom_array'.
ERROR:HDLParsers:1209 - "C:/Users/user/DigitalProje/Basic.vhd" Line 19. rom_array: Undefined symbol (last report in this block)
ERROR:HDLParsers:3285 - "C:/Users/user/DigitalProje/Basic.vhd" Line 19. No array or record type can be found that has elements of types matching the aggregate.
ERROR:HDLParsers:532 - "C:/Users/user/DigitalProje/Basic.vhd" Line 19. Deferred constant are allowed only in packages.
ERROR:HDLParsers:808 - "C:/Users/user/DigitalProje/Basic.vhd" Line 35. = can not have such operands in this context.
ERROR:HDLParsers:800 - "C:/Users/user/DigitalProje/Basic.vhd" Line 41. Type of reg_address is incompatible with type of 00000.
곰 이전 값이 끝나면 나눗셈 값을 사용하면 각 주파수에서 단일 전환 만 생성됩니다. 순서대로 "음표"를 연주하려면 각 뚜렷한 음색을들을 수있는 (훨씬 느린) 안정된 시계를 기반으로 음표 목록을 반복해야합니다. 또한이 메서드로 음색을 오버레이 할 수 없습니다. 음악 오디오 파일 (압축되지 않은 경우)이 많은 개별 톤으로 구성된 실제 파형을 복제하기 위해 초당 24,000 회 이상 저장된 진폭 측정 값을 갖는 이유입니다. – QuantumRipple
더 이상 방해해서 죄송합니다. 초보자이며 임베디드 이외의 시계를 사용하는 방법을 모르겠습니다. 당신은 정교 할 수 있습니까? – Strider
기존 시계에서 느린 시계를 생성하는 몇 가지 방법이 있습니다. 대부분의 FPGA에는 클럭을 여러 가지 방법으로 곱하거나 나눌 수있는 전용 클록 조작 블록이 있습니다.하지만 톤 생성기로 카운터를 사용하여 나눈 클럭을 생성 할 수도 있습니다. 아마도 실제 클럭 대신 카운터가 롤오프 될 때 노트 ROM의 주소를 증가시키기 위해 25MHz (기본 클럭) 도메인에서 프로세스를 만들 것입니다. 이것은 클록 인 에이블을 사용하여 여러 클럭 도메인을 다루지 않고도 원하는 속도 저하를 얻을 수 있습니다. – QuantumRipple