VHDL을 처음 사용하고 있으며 과제 중 하나가 8 비트 레지스터 파일을 만드는 것이 었습니다. 한 줄의 코드를 변경하면 논리 요소의 총 수를 크게 늘리거나 줄일 수 있다는 것을 알게되었습니다. 나는 이것이 왜 이처럼 중요한 변화를 일으키는 지 이해하려고 노력하고 있습니다. enable
이 높으면VHDL 레지스터 파일의 작은 변화로 인해 총 논리 요소의 차이가 커졌습니다.
는 레지스터 파일 selectWrite
의 위치 dataIn
의 값을 저장한다. dataOut
은 selectRead
의 위치에 저장된 값을 표시합니다. dataOut <= entry(readIndex);
경우
가 process(clock)
의 내부에 배치되고, 사용 된 논리 요소의 총 개수이다 : 그러나
Total logical elements: 9/33,216 (< 1%)
Total combinatorial functions 9/33,216 (< 1%)
Dedicated logic registers 0/33,216 (0%)
, dataOut <= entry(readIndex);
보다 논리 소자가 사용된다 process(clock)
수천의 외부에 배치되는 경우 :
Total logical elements: 2,672/33,216 (8%)
Total combinatorial functions 1,656/33,216 (5%)
Dedicated logic registers 2,048/33,216 (6%)
process(clock)
안에 넣을 경우 dataOut
은 시계 가장자리에서만 변경되며 process(clock)
,외부에 배치하면 210은 예기치 않게 변경 될 것입니다.
이 변경으로 인해 더 많은 로직 요소가 사용되는 이유는 무엇입니까?
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity RegisterFile is
port(
clock : in std_logic;
reset : in std_logic;
dataIn : in std_logic_vector(7 downto 0);
enable : in std_logic;
selectRead : in std_logic_vector(7 downto 0);
selectWrite : in std_logic_vector(7 downto 0);
dataOut : out std_logic_vector(7 downto 0)
);
end RegisterFile;
architecture RegisterFileArchitecture of RegisterFile is
type RegisterEntry is array (0 to 255) of std_logic_vector(7 downto 0);
signal entry : RegisterEntry;
signal readIndex : integer;
signal writeIndex : integer;
begin
-- Update read/write indices
readIndex <= to_integer(unsigned(selectRead));
writeIndex <= to_integer(unsigned(selectWrite));
process(clock)
begin
if (rising_edge(clock)) then
-- Update selected data
dataOut <= entry(readIndex);
if (reset = '1') then
entry(writeIndex) <= "00000000";
elsif (enable = '1') then
entry(writeIndex) <= dataIn;
end if;
end if;
end process;
end RegisterFileArchitecture;
동기 대 비동기 읽기. 다양한 요구 사항을 충족시키기 위해 신디 추론 된 RAM에 대한 정보를 합성 보고서 (.syr)에서 찾을 수 있습니다. 나는 "더 작은"RAM 블록을 사용하는 것으로 추측하고 있습니다 ... –
Brian과 동의합니다 ... 그러나 일부 신디사이저는 RAM (예 : ISE 13.4)과 함께 두 버전을 구현하므로 더 많거나 적은 같은 크기 . 추가 힌트 : 범위 (예 : 신호 readIndex : 정수 범위 0 ~ 255 : = 0)로 색인 신호를 정의하십시오. 그렇지 않으면 32 비트 신호가 정수로 사용됩니다! – baldyHDL