목차
1. ALU 설계 목적
2. 설계 방법
3. 프로그램
4. simulation
5. 4 X 8 register file을 포함한 ALU 설계
1) 설계 방법
2) 프로그램
3) simulation
6. 고찰
2. 설계 방법
3. 프로그램
4. simulation
5. 4 X 8 register file을 포함한 ALU 설계
1) 설계 방법
2) 프로그램
3) simulation
6. 고찰
본문내용
-- pass
when \"01\" => output <= input(6 downto 0) & \'0\'; -- 오른쪽으로 쉬프트
when \"10\" => output <= \'0\' & input(7 downto 1); -- 왼쪽으로 쉬프트
when others => output <= input(0) & input(7 downto 1); -- 오른쪽 회전
end case;
end process;
end behavior;
(5) 3상태 버퍼 프로그램
library ieee;
use ieee.std_logic_1164.all;
entity tri_buf is port(
e : in std_logic;
d : in std_logic_vector(7 downto 0);
y : out std_logic_vector(7 downto 0));
end tri_buf;
architecture behavioral of tri_buf is
begin
process(e,d)
begin
if( e =\'1\') then -- 1 이면 pass
y <= d;
else
y <= (others =>\'Z\'); --1이 아니면 Z값 표시
end if;
end process;
end behavioral;
(6) 전체 메인 프로그램
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity reg_alu is port(
clock : in std_logic;
input : in std_logic_vector(7 downto 0);
ie, we : in std_logic;
WA : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
RAE : IN STD_LOGIC;
RAA : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
RBE : IN STD_LOGIC;
RBA : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
ALUsel : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
SHsel : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
OE : IN STD_LOGIC;
OUTPUT : OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END reg_alu;
architecture structural of reg_alu is
component mux2 port(
s : in std_logic;
d0, d1:in std_logic_vector(7 downto 0);
y : out std_logic_vector(7 downto 0));
end component;
component regfile port(
clk : in std_logic;
WE : IN STD_LOGIC; --write enable
WA : IN STD_LOGIC_VECTOR(1 DOWNTO 0); --write address
INPUT : IN STD_LOGIC_VECTOR(7 DOWNTO 0); --입력
RAE : IN STD_LOGIC; --read enable ports A
RAA : IN STD_LOGIC_VECTOR(1 DOWNTO 0); --read address port A
RBE : IN STD_LOGIC; --read enable ports B
RBA : IN STD_LOGIC_VECTOR(1 DOWNTO 0); --read address port A
AOUT, BOUT : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); --출력
end component;
component alu2 port(
ALUSEL : IN STD_LOGIC_VECTOR(2 DOWNTO 0); --ALU 선택
A, B : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
F : OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
end component;
component shifter port(
shsel : in std_logic_vector(1 downto 0); -- shifter 레지스터 선택라인
input : in std_logic_vector(7 downto 0);
output : out std_logic_vector(7 downto 0));
end component;
component tri_buf port(
e : in std_logic;
d : in std_logic_vector(7 downto 0);
y : out std_logic_vector(7 downto 0));
end component;
signal muxout, aout, bout : std_logic_vector(7 downto 0); --signal 선언
signal alu2out, shout, triout : std_logic_vector(7 downto 0);
begin
U0: mux2 port map(IE,input,shout,muxout);
U1: regfile port map(clock,WE,WA,muxout,RAE,RAA,RBE,RBA,aout,bout);
U2: alu2 port map(ALUsel,aout,bout,alu2out);
U3: shifter port map(SHsel,alu2out,shout);
U4: tri_buf port map(oe,shout,triout);
output <= triout;
end structural;
3) simulation
※시뮬의 그림이 중간값을 캡쳐한것같습니다. input에 원래 입력값을 10을로 주었습니다.
6. 고찰
이번 설계를 하면서 CPU의 구성을 확실하게 이해하게 된 것 같습니다. 복잡 할 줄만 알았던 CPU가 단순한 연산만으로 구성되어 처리되는 것이 신기 하였습니다. 물론 아직까지 제가 모르는 부분이 많이 있다고 생각합니다.
설계를 하면서 아쉬운 점은 프로그램 컴파일에서 많은 에러가 났던 부분과 수업시간에 했던 자인린스로 프로그램 시뮬을 돌리지 못해 아쉬웠습니다.
많은 오류가 났지만 끝까지 분석하고 오류를 찾아내고 수정하면서 마지막엔 뿌듯함도 느꼈습니다.
앞으로도 이것을 응용한 여러 가지 프로그램에 도전하고 공부하겠습니다.
when \"01\" => output <= input(6 downto 0) & \'0\'; -- 오른쪽으로 쉬프트
when \"10\" => output <= \'0\' & input(7 downto 1); -- 왼쪽으로 쉬프트
when others => output <= input(0) & input(7 downto 1); -- 오른쪽 회전
end case;
end process;
end behavior;
(5) 3상태 버퍼 프로그램
library ieee;
use ieee.std_logic_1164.all;
entity tri_buf is port(
e : in std_logic;
d : in std_logic_vector(7 downto 0);
y : out std_logic_vector(7 downto 0));
end tri_buf;
architecture behavioral of tri_buf is
begin
process(e,d)
begin
if( e =\'1\') then -- 1 이면 pass
y <= d;
else
y <= (others =>\'Z\'); --1이 아니면 Z값 표시
end if;
end process;
end behavioral;
(6) 전체 메인 프로그램
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity reg_alu is port(
clock : in std_logic;
input : in std_logic_vector(7 downto 0);
ie, we : in std_logic;
WA : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
RAE : IN STD_LOGIC;
RAA : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
RBE : IN STD_LOGIC;
RBA : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
ALUsel : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
SHsel : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
OE : IN STD_LOGIC;
OUTPUT : OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
END reg_alu;
architecture structural of reg_alu is
component mux2 port(
s : in std_logic;
d0, d1:in std_logic_vector(7 downto 0);
y : out std_logic_vector(7 downto 0));
end component;
component regfile port(
clk : in std_logic;
WE : IN STD_LOGIC; --write enable
WA : IN STD_LOGIC_VECTOR(1 DOWNTO 0); --write address
INPUT : IN STD_LOGIC_VECTOR(7 DOWNTO 0); --입력
RAE : IN STD_LOGIC; --read enable ports A
RAA : IN STD_LOGIC_VECTOR(1 DOWNTO 0); --read address port A
RBE : IN STD_LOGIC; --read enable ports B
RBA : IN STD_LOGIC_VECTOR(1 DOWNTO 0); --read address port A
AOUT, BOUT : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); --출력
end component;
component alu2 port(
ALUSEL : IN STD_LOGIC_VECTOR(2 DOWNTO 0); --ALU 선택
A, B : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
F : OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
end component;
component shifter port(
shsel : in std_logic_vector(1 downto 0); -- shifter 레지스터 선택라인
input : in std_logic_vector(7 downto 0);
output : out std_logic_vector(7 downto 0));
end component;
component tri_buf port(
e : in std_logic;
d : in std_logic_vector(7 downto 0);
y : out std_logic_vector(7 downto 0));
end component;
signal muxout, aout, bout : std_logic_vector(7 downto 0); --signal 선언
signal alu2out, shout, triout : std_logic_vector(7 downto 0);
begin
U0: mux2 port map(IE,input,shout,muxout);
U1: regfile port map(clock,WE,WA,muxout,RAE,RAA,RBE,RBA,aout,bout);
U2: alu2 port map(ALUsel,aout,bout,alu2out);
U3: shifter port map(SHsel,alu2out,shout);
U4: tri_buf port map(oe,shout,triout);
output <= triout;
end structural;
3) simulation
※시뮬의 그림이 중간값을 캡쳐한것같습니다. input에 원래 입력값을 10을로 주었습니다.
6. 고찰
이번 설계를 하면서 CPU의 구성을 확실하게 이해하게 된 것 같습니다. 복잡 할 줄만 알았던 CPU가 단순한 연산만으로 구성되어 처리되는 것이 신기 하였습니다. 물론 아직까지 제가 모르는 부분이 많이 있다고 생각합니다.
설계를 하면서 아쉬운 점은 프로그램 컴파일에서 많은 에러가 났던 부분과 수업시간에 했던 자인린스로 프로그램 시뮬을 돌리지 못해 아쉬웠습니다.
많은 오류가 났지만 끝까지 분석하고 오류를 찾아내고 수정하면서 마지막엔 뿌듯함도 느꼈습니다.
앞으로도 이것을 응용한 여러 가지 프로그램에 도전하고 공부하겠습니다.
키워드
추천자료
- 케이블 방송 예능 프로그램 언어 분석 - 공중파 동종 프로그램과 비교를 중심으로
- [가족복지][가족복지프로그램][가족복지정책][가족복지제도][가족문제][핵가족][가족]가족복...
- [방송언어학] 교양 프로그램 진행자와 오락 프로그램 진행자의 차이점
- 오감 활용 프로그램 계획안,그림책을 이용한 문학적 접근 프로그램 계획안
- (아동복지D)아동복지정책 프로그램의 사례를 제시하여 정책의 목표, 현황, 앞으로의 과제를 ...
- [근로자 원조 프로그램] 근로자원조프로그램의 제공방식과 유의점
- 노인일자리 창출 프로그램과 우수프로그램
- [디지털위성방송, 프로그램수급, 수신기]디지털위성방송의 개념, 디지털위성방송의 도입, 디...
- [영유아 프로그램 개발과 평가] 일과 운영 내용 및 원리, 일과활동, 영유아 프로그램 운영의 ...
- 현장에서 실시되고 있는 프로그램을 조사하여 프로그램에 대한 평가서 작성하기 - 평가목적
- 자신이 현장에서 해보고 싶은 가족생활교육 프로그램을 생각해보고 가족생활교육 프로그램 기...
- [건강가정론] 건강가정지원 프로그램 중 1개의 프로그램을 선정하여 이에 대해 평가하여 보세...
소개글