일부 레지스터에 대한 읽기 및 쓰기 작업을 처리하고 레지스터간에 데이터를 전송하기 위해 단일 버스를 사용하는 회로를 만들고 있습니다. 문제는 버스에서 읽기 (레지스터가 버스에서 읽기) 문제가 있다는 것입니다. 레지스터에 값을 할당하는 것은 작동하지 않습니다. 내가 쓸 신호를 사용하면 작동 할 것입니다!왜 INOUT이 작동하지 않습니까?
내 코드 : 당신이 생성 성명에서 lbl1
보면
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
-- Entity: Circuit
-- Description: Organizes read and write operation to the bus
-- n is the size of word in a register, default is 16
-- m is the number of selection lines in the decoder, so 2^m
-- is the number of registers in the cicuit
-- data_bus: the bus used to transfer data
-- reg_read: input to a decoder determines which register to read from bus.
-- reg_write: input to a decoder determines which register to write to bus.
-- read: read signal
-- write: write signal
-- Clk: clock
-- Rst: Reset
ENTITY circuit IS
GENERIC(n : integer := 16;
m : integer := 2);
PORT(data_bus : INOUT STD_LOGIC_VECTOR(n-1 DOWNTO 0);
reg_read, reg_write : IN STD_LOGIC_VECTOR(m-1 DOWNTO 0);
read, write, Clk, Rst : IN STD_LOGIC);
END circuit;
ARCHITECTURE circuit_arch OF circuit IS
-- Tristate buffers
COMPONENT tsb IS
GENERIC (n : integer := 16);
PORT (E : IN STD_LOGIC;
Input : IN STD_LOGIC_VECTOR (n-1 DOWNTO 0);
Output : OUT STD_LOGIC_VECTOR (n-1 DOWNTO 0));
END COMPONENT;
-- Registers
COMPONENT ndff IS
GENERIC (n : integer := 16);
PORT(Clk,Rst,E : in STD_LOGIC;
d : IN STD_LOGIC_VECTOR(n-1 dOWNTO 0);
output : OUT STD_LOGIC_VECTOR(n-1 dOWNTO 0));
END COMPONENT;
-- Decoders
COMPONENT nDecoder IS
GENERIC (n : integer := 4);
PORT(E : IN std_logic;
S : IN STD_LOGIC_VECTOR(n-1 DOWNTO 0);
output : OUT std_logic_vector(2 ** n - 1 DOWNTO 0));
END COMPONENT;
TYPE output IS ARRAY (0 TO (2 ** m) - 1) OF STD_LOGIC_VECTOR (n-1 DOWNTO 0);
SIGNAL read_dec, write_dec : STD_LOGIC_VECTOR(2 ** m - 1 DOWNTO 0);
SIGNAL regs_out : output;
SIGNAL test : STD_LOGIC_VECTOR(n-1 downto 0);
BEGIN
-- Generate decoders
dec1: nDecoder GENERIC MAP(m) PORT MAP(read, reg_read, read_dec);
dec2: nDecoder GENERIC MAP(m) PORT MAP(write, reg_write, write_dec);
-- Generate registers
LOOP1: FOR i IN 0 TO (2 ** m) - 1 GENERATE
lbl1: ndff GENERIC MAP(n) PORT MAP(Clk, Rst,read_dec(i),data_bus, regs_out(i));
END GENERATE;
-- Generate tristate buffers
LOOP2: FOR j IN 0 TO (2 ** m) - 1 GENERATE
lbl2: tsb GENERIC MAP(n) PORT MAP(write_dec(j), regs_out(j), data_bus);
END GENERATE;
END circuit_arch;
"tsb"에 엔티티/아치를 추가하십시오. –
디자인 대상 플랫폼은 무엇입니까? (FPGA, ASIC, Xilinx, Altera, Virtex, Stratix 등) – Paebbels
[최소, 완전하며 검증 가능한 예제] (http://stackoverflow.com/help/mcve)를 제공하지 않은 방법으로보기 그것이 작동하지 않는다는 것을 알려주는 파형을 보여줄 수 있습니까? "신호를 쓰면 쓸 수 있습니다." 매우 모호한 것 같습니다. 방법론과 연결성은 설명하지 않습니다. – user1155120