디시인사이드 갤러리

갤러리 이슈박스, 최근방문 갤러리

갤러리 본문 영역

vhdl 오류좀 도와줘유

소나비(220.67) 2010.12.20 18:19:22
조회 59 추천 0 댓글 3

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity locker is
port(
clk, rst : in std_logic;
input : in std_logic_vector(3 downto 0);
G : in std_logic;
Stop : in std_logic;
comp : in std_logic;


seg_out : out std_logic_vector(7 downto 0);
seg_sel : out std_logic_vector(7 downto 0));

end locker;

architecture Behavioral of locker is

type state_type is (IDLE, state0, state1, state2, state3, err, success);
signal state, next_state : state_type;
signal C, Op : std_logic_vector(2 downto 0);
signal judgment : std_logic_vector(1 downto 0);
signal check_out : std_logic_vector(1 downto 0);
signal key_save, key_save2, key_save3, key_save4 : std_logic_vector(3 downto 0);
signal key_next_save, key_next_save2, key_next_save3, key_next_save4 : std_logic_vector(3 downto 0);
signal key_comp, key_comp2, key_comp3, key_comp4 : std_logic_vector(3 downto 0);
signal key_next_comp, key_next_comp2, key_next_comp3, key_next_comp4 : std_logic_vector(3 downto 0);
signal sgselector, segout : std_logic_vector(7 downto 0);
signal j, k, l : std_logic;

 


begin

seg_out <= segout;
seg_sel <= sgselector;

process(clk, rst)
begin
if clk\'event and clk = \'1\' then
if rst = \'1\' then
state <= IDLE;
else
state <= next_state;
key_save <= key_next_save;
key_save2 <= key_next_save2;
key_save3 <= key_next_save3;
key_save4 <= key_next_save4;
key_comp <= key_next_comp;
key_comp2 <= key_next_comp2;
key_comp3 <= key_next_comp3;
key_comp4 <= key_next_comp4;

end if;
end if;
end process;


process(state, next_state, C, Op, judgment, G, C, comp, stop)
begin
case state is
when IDLE => if G = \'1\' then
next_state <= state0;
else
next_state <= IDLE;
end if;

when state0 => --set_key
case C is --setting key is complete : "11";--
when "100" => next_state <= state1;
when others => next_state <= state0;
end case;
when state1 =>
if comp = \'1\' then
next_state <= state2;
else
next_state <= state1;
end if;
when state2 =>
case Op is
when "100" => --comp_key setting up
next_state <= state3;
when others => next_state <= state2;
end case;
when state3 => case judgment is
when "00" => next_state <= state3;
when "01" => --error
next_state <= err;
when "10" => --success
next_state <= success;
when others => next_state <= state3;
end case;
when err => --error
if Stop = \'1\' then
next_state <= IDLE;
else
next_state <= err;
end if;
when success => --success
if Stop = \'1\' then
next_state <= IDLE;
else
next_state <= success;
end if;
when others => next_state <= IDLE;
end case;

end process;

datapath_func : process(clk, C, Op, state, j, k, l, judgment, check_out)
begin
if clk\'event and clk = \'1\' then
case state is
when IDLE => C <= "000";

check_out <= "00";
segout <= "00000000";
Op <= "000";
key_next_save <= "0000";
key_next_save2 <= "0000";
key_next_save3 <= "0000";
key_next_save4 <= "0000";
key_next_comp <= "0000";
key_next_comp2 <= "0000";
key_next_comp3 <= "0000";
key_next_comp4 <= "0000";

when state0 => case C is
when "000" => key_next_save <= input;
key_next_save2 <= key_save2;
key_next_save3 <= key_save3;
key_next_save4 <= key_save4;
C <= "001";
if key_save = "0000" then
C <= "000";

end if;
when "001" => key_next_save2 <= input;
key_next_save <= key_save;
key_next_save3 <= key_save3;
key_next_save4 <= key_save4;
C <= "010";
if key_save2 = "0000" then
C <= "001";
end if;
when "010" => key_next_save3 <= input;
key_next_save <= key_save;
key_next_save2 <= key_save2;
key_next_save4 <= key_save4;
C <= "011";
if key_save3 = "0000" then
C <= "010";
end if;
when "011" => key_next_save4 <= input;
key_next_save <= key_save;
key_next_save2 <= key_save2;
key_next_save3 <= key_save3;
C <= "100";
if key_save4 = "0000" then
C <= "011";
end if;
when "100" => key_next_save <= key_save;
key_next_save2 <= key_save2;
key_next_save3 <= key_save3;
key_next_save4 <= key_save4;
when others => key_next_save <= key_save;
key_next_save2 <= key_save2;
key_next_save3 <= key_save3;
key_next_save4 <= key_save4;
end case;

when state1 =>
when state2 => case OP is
when "000" => key_next_comp <= input;
key_next_comp2 <= key_comp2;
key_next_comp3 <= key_comp3;
key_next_comp4 <= key_comp4;
Op <= "001";
if key_comp = "0000" then
Op <= "000";
end if;
when "001" => key_next_comp2 <= input;
key_next_comp <= key_comp;
key_next_comp3 <= key_comp3;
key_next_comp4 <= key_comp4;
Op <= "010";
if key_comp2 = "0000" then
Op <= "001";
end if;
when "010" => key_next_comp3 <= input;
key_next_comp <= key_comp;
key_next_comp2 <= key_comp2;
key_next_comp4 <= key_comp4;
Op <= "011";
if key_comp3 = "0000" then
Op <= "010";
end if;
when "011" => key_next_comp4 <= input;
key_next_comp <= key_comp;
key_next_comp2 <= key_comp2;
key_next_comp3 <= key_comp3;
Op <= "100";
if key_comp4 = "0000" then
Op <= "011";
end if;
when "100" => key_next_comp <= key_comp;
key_next_comp2 <= key_comp2;
key_next_comp3 <= key_comp3;
key_next_comp4 <= key_comp4;
when others => key_next_comp <= key_comp;
key_next_comp2 <= key_comp2;
key_next_comp3 <= key_comp3;
key_next_comp4 <= key_comp4;
end case;

when state3 => if key_comp = key_save then
j <= \'1\';
judgment <= "00";
else
j <= \'0\';
judgment <= "00";
end if;

if j = \'1\' then
if key_comp2 = key_save2 then
k <= \'1\';
judgment <= "00";
else
k <= \'0\';
judgment <= "00";
end if;
else
judgment <= "01";
end if;

if k = \'1\' then
if key_comp3 = key_save3 then
l <= \'1\';
judgment <= "00";
else
l <= \'0\';
judgment <= "00";
end if;
else
judgment <= "01";
end if;

if l = \'1\' then
if key_comp4 = key_save4 then
judgment <= "10";
else
judgment <= "01";
end if;
else
judgment <= "01";
end if;

 

when err => check_out <= "01";
when success => check_out <= "10";
when others => check_out <= "10";
end case;
end if;
end process;

process(clk,rst)
begin
if clk\'event and clk = \'1\' then
if rst = \'1\' then
sgselector <= "01111111";
elsif sgselector = "11111110" then
sgselector <= "01111111";
else
sgselector <= \'1\' & sgselector(7 downto 1);
end if;
end if;
end process;

process(check_out, segout, sgselector)
begin
if check_out = "00" then
if sgselector(7) = \'0\' then
segout <= "00000000";
elsif sgselector(6) = \'0\' then
segout <= "00000000";
elsif sgselector(5) = \'0\' then
segout <= "00000000";
elsif sgselector(4) = \'0\' then
segout <= "00000000";
elsif sgselector(3) = \'0\' then
segout <= "00000000";
elsif sgselector(2) = \'0\' then
segout <= "00000000";
elsif sgselector(1) = \'0\' then
segout <= "00000000";
elsif sgselector(0) = \'0\' then
segout <= "00000000";
else
segout <= "00000000";
end if;

elsif check_out = "01" then
if sgselector(7) = \'0\' then
segout <= "10001100";
elsif sgselector(6) = \'0\' then
segout <= "11111100";
elsif sgselector(5) = \'0\' then
segout <= "10001100";
elsif sgselector(4) = \'0\' then
segout <= "10001100";
elsif sgselector(3) = \'0\' then
segout <= "10011110";
elsif sgselector(2) = \'0\' then
segout <= "00000000";
elsif sgselector(1) = \'0\' then
segout <= "00000000";
elsif sgselector(0) = \'0\' then
segout <= "00000000";
else
segout <= "00000000";
end if;

elsif check_out = "10" then
if sgselector(7) = \'0\' then
segout <= "10110110";
elsif sgselector(6) = \'0\' then
segout <= "10011110";
elsif sgselector(5) = \'0\' then
segout <= "10011100";
elsif sgselector(4) = \'0\' then
segout <= "10011100";
elsif sgselector(3) = \'0\' then
segout <= "01111100";
elsif sgselector(2) = \'0\' then
segout <= "10110110";
elsif sgselector(1) = \'0\' then
segout <= "00000000";
elsif sgselector(0) = \'0\' then
segout <= "00000000";
else
segout <= "00000000";
end if;

else
if sgselector(7) = \'0\' then
segout <= "00000000";
elsif sgselector(6) = \'0\' then
segout <= "00000000";
elsif sgselector(5) = \'0\' then
segout <= "00000000";
elsif sgselector(4) = \'0\' then
segout <= "00000000";
elsif sgselector(3) = \'0\' then
segout <= "00000000";
elsif sgselector(2) = \'0\' then
segout <= "00000000";
elsif sgselector(1) = \'0\' then
segout <= "00000000";
elsif sgselector(0) = \'0\' then
segout <= "00000000";
else
segout <= "00000000";
end if;

end if;
end process;
end Behavioral;
이것이 코드입니다.
maxIIplus 로 돌리는데 오류가 하나가 나네요
오류 내용은 segout 에 multiple source 나오는데 당최 못잡겠네요.
도와주세유

추천 비추천

0

고정닉 0

0

댓글 영역

전체 댓글 0
등록순정렬 기준선택
본문 보기

하단 갤러리 리스트 영역

왼쪽 컨텐츠 영역

갤러리 리스트 영역

갤러리 리스트
번호 제목 글쓴이 작성일 조회 추천
설문 가족과 완벽하게 손절해야 할 것 같은 스타는? 운영자 24/06/24 - -
227652 cpu 설계 재미있다 [17] 넉넉한턱갤로그로 이동합니다. 10.12.28 226 0
227651 진실or거짓 - C언어는 장난이었다. [5] Finalizer갤로그로 이동합니다. 10.12.28 251 0
227650 크롬에 힛갤 알리미 같은 익스텐션 잇엇으면 젛갯어여 갤러리갤로그로 이동합니다. 10.12.28 79 0
227649 내가 토익이 740점인데 [2] Finalizer갤로그로 이동합니다. 10.12.28 96 0
227648 숏코딩 이딴거 왜하냐. [3] Finalizer갤로그로 이동합니다. 10.12.28 118 0
227647 대항온 이거 업데이트 방식이 특이하네 [2] ㅁㄴㄻㄹ갤로그로 이동합니다. 10.12.28 97 0
227645 컴터 샀는데 xp쓰다 윈7 쓰니 ㅎㄷㄷ [5] 비우그라갤로그로 이동합니다. 10.12.28 130 0
227643 진단 페이지 news.danawa.com/tv [1] 갤러리갤로그로 이동합니다. 10.12.28 59 0
227642 토렌트 괜춘헌데 추천좀 [5] elwlwlwk갤로그로 이동합니다. 10.12.28 88 0
227640 언어별 개발자 테크트리 [3] 임베디드(112.150) 10.12.28 351 0
227639 넉넉한턱이라니 [1] 넉넉한터갤로그로 이동합니다. 10.12.28 52 0
227638 영어 도대체 얼마나 잘해야하지? [13] 영어(124.194) 10.12.28 203 0
227636 요새 php 클래스 지원합니꽈? [3] 르하소갤로그로 이동합니다. 10.12.28 76 0
227635 안드로이드는 [5] ㄴㄴ(124.194) 10.12.28 101 0
227634 치킨과 Vector , HashMap, ArrayList<Object> [2] 임베디드(112.150) 10.12.28 273 0
227633 안녕하세요 ㅋ [4] 넉넉한턱갤로그로 이동합니다. 10.12.28 79 0
227632 형들 자바... [5] 사막펭귄갤로그로 이동합니다. 10.12.28 97 0
227631 마라시라면 이거 [2] elwlwlwk갤로그로 이동합니다. 10.12.28 50 0
227630 헬스 이틀째 [3] elwlwlwk갤로그로 이동합니다. 10.12.28 75 0
227629 예스맨 상사 덕분에 조금 힘들다 [9] ㅋㅋㅋ(121.141) 10.12.28 169 0
227628 그나저나 크롬 우월하네 [14] 땡칠도사갤로그로 이동합니다. 10.12.28 189 0
227627 웹만 할꺼면 c나 c++ 깊게 안배워도됨?? [8] 69(183.101) 10.12.28 173 0
227626 아 집이 왠지 춥더라 [1] 꿀레갤로그로 이동합니다. 10.12.28 70 0
227625 근데 시스코 홈페이지 개짜증나네 [1] 풋사과1갤로그로 이동합니다. 10.12.28 62 0
227624 이너클래스 많이쓰는거냐... [9] 꿀레갤로그로 이동합니다. 10.12.28 214 0
227622 실습실 컬러프린터가 좀 좋네 [2] 푸의미래갤로그로 이동합니다. 10.12.28 77 0
227620 헌재, “전기통신법의 ‘허위사실유포’ 조항은 위헌” [1] 땡칠도사갤로그로 이동합니다. 10.12.28 86 0
227618 아오 빡쳐 [9] 숙신갤로그로 이동합니다. 10.12.28 249 0
227617 횽들 다시좀 C++질문점 ㅎㅎ [2] 메론맛사탕(221.162) 10.12.28 125 0
227616 벅스 save 요금제 이거 뭐지... [1] OnlyCesc갤로그로 이동합니다. 10.12.28 264 0
227615 헬스장에갔더니 [1] 꿀레갤로그로 이동합니다. 10.12.28 79 0
227614 피아노 [2] 병맛알콜(110.15) 10.12.28 50 0
227613 덕짤 투척 [5] 땡칠도사갤로그로 이동합니다. 10.12.28 140 0
227612 너님들아 [3] 서울개트로갤로그로 이동합니다. 10.12.28 67 0
227610 형들 다른나라에서 우리나라ip차단먹엿을때 다른나라 아이피로 위장해서 [8] 외국IP(122.42) 10.12.28 191 0
227609 오랜만에 진지하게 윈도우즈 플그래밍 [3] 땡칠도사갤로그로 이동합니다. 10.12.28 138 0
227608 c++ 질문이요~~~★ ^^ [3] 메론맛사탕(221.162) 10.12.28 176 0
227607 아니 SKT에서 KT로 폰 바꿨다고 멜론 다운받은거 이용 못한다니 ㅡㅡ [1] OnlyCesc갤로그로 이동합니다. 10.12.28 301 0
227606 아ㅏ시발상속나만어려운건가.. [5] 개새끼■갤로그로 이동합니다. 10.12.28 101 0
227605 프로그래머하면 생각나는거 [6] 갤러리갤로그로 이동합니다. 10.12.28 147 0
227604 안녕하세요 기름쟁이입니다. [1] 기름쟁이(1.224) 10.12.28 79 0
227603 오늘 알바를 하고있는데요 이상한 소리 들었음 [2] 죽음신도아겜(125.190) 10.12.28 77 0
227602 오늘은 축제의 날입니다 형들 [3] OnlyCesc갤로그로 이동합니다. 10.12.28 76 0
227601 훈련소 갔다와서 잘할 자신 생긴거 [4] cyluss갤로그로 이동합니다. 10.12.28 109 0
227599 미국에서 가장 많이 쓰이는 언어 비베 [11] 아잉따잉갤로그로 이동합니다. 10.12.28 222 0
227598 여자 때리는게 사람이냐? [10] cyluss갤로그로 이동합니다. 10.12.28 239 0
227597 꼭 버스안에서 디씨를 해야겠음? [2] 꿀레갤로그로 이동합니다. 10.12.28 91 0
227596 횽들 뇌자알 있잖아여 [2] 블랑카(115.41) 10.12.28 115 0
227595 오늘은 하루종일 [2] Rei@디씨갤로그로 이동합니다. 10.12.28 81 0
227594 UML류 말고 프로그래밍 관련한 아이디어나 다이어그램 같은거 정리하는 프로그램 있음미까?? [7] 시불라미갤로그로 이동합니다. 10.12.28 151 0
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2