뭐...



library ieee;
use ieee.std_logic_1164.all;


entity FullSubtractor_xor_vhdl is

	port (
		x, y, z		:	in		std_logic;
		D, B		:	out		std_logic
	);

end FullSubtractor_xor_vhdl;


architecture arc of FullSubtractor_xor_vhdl is
begin

	D	<=	x xor y xor z;
	B	<=	((not (x xor y)) and z) or ((not x) and y);
	
end arc;



'book > VHDL을 이용한 FPGA 디지털 설계' 카테고리의 다른 글

lab06. 수의 정렬회로 설계  (0) 2014.06.25
7-segment decoder  (0) 2014.06.05
xor을 이용한 전가산기 설계  (0) 2014.06.04
전감산기의 설계  (0) 2014.06.04
전가산기의 VHDL 설계  (0) 2014.06.03
Posted by 쿨한넘

입력이 2개인 경우에 두 입력이 서로 다른 값일 경우 xor의 출력은 '1'. 입력이 세개인 경우 '1'값이 홀수개인 경우에 xor의 출력이 '1'.

이를 이용하여 전가산기 설계.



library ieee;
use ieee.std_logic_1164.all;


entity FullAdder_xor_vhdl is

	port (
		x, y, z		:	in		std_logic;
		S, C		:	out		std_logic
	);
	
end FullAdder_xor_vhdl;


architecture arc of FullAdder_xor_vhdl is
begin

	S	<=	x xor y xor z;
	C	<=	(z and (x xor y)) or (x and y);
	
end arc;



'book > VHDL을 이용한 FPGA 디지털 설계' 카테고리의 다른 글

7-segment decoder  (0) 2014.06.05
xor을 이용한 전감산기 설계  (0) 2014.06.04
전감산기의 설계  (0) 2014.06.04
전가산기의 VHDL 설계  (0) 2014.06.03
VHDL을 이용한 FPGA 디지털 설계  (0) 2014.06.03
Posted by 쿨한넘

D = (X - Bi) - Y

Bi는 아래 자리에 빌려준 값. 입력이 된다.

위에서 빌린 수는 B로 표현되고, 진리표를 작성해보면 쉽다.




--
--
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;


entity FullSubtractor_vhdl is

	port (
		X, Y, bi	:	in	integer range 0 to 1;
		D, B		:	out	std_logic
	);

end FullSubtractor_vhdl;


architecture arc of FullSubtractor_vhdl is

	signal	diff	:	integer range -2 to 1;

begin

	process(X, Y, bi)
	begin
	
		diff <= X - bi - Y;
		
		if diff = -2 then		-- XYbi = 011

			D	<=	'0';
			B	<=	'1';
			
		elsif diff = -1 then	-- XYbi = 001, 010, 111
		
			D	<=	'1';
			B	<=	'1';
			
		elsif diff = 0 then		-- XYbi = 000, 101, 110
		
			D	<=	'0';
			B	<=	'0';
			
		else					-- XYbi = 100
		
			D	<=	'1';
			B	<=	'0';
			
		end if;

	
	end process;


end arc;



Posted by 쿨한넘



--
-- VHDL을 이용한 FPGA 디지털 설계
--  3장. 조합논리 회로의 설계
--   section 02. 전가산기
--

library ieee;
use ieee.std_logic_1164.all;


entity FullAdder1_vhdl is

	port (
		x, y, z		:	in	std_logic;
		S, C		:	out	std_logic
	);

end FullAdder1_vhdl;


architecture arc of FullAdder1_vhdl is

	signal	k	:	std_logic_vector(2 downto 0);

begin

	k	<=	x & y & z;

	
	process(k)
	begin
	
		case k is

			when "000"	=>
				S	<=	'0';
				C	<=	'0';

			when "001"	=>
				S	<=	'1';
				C	<=	'0';

			when "010"	=>
				S	<=	'1';
				C	<=	'0';

			when "011"	=>
				S	<=	'0';
				C	<=	'1';

			when "100"	=>
				S	<=	'1';
				C	<=	'0';

			when "101"	=>
				S	<=	'0';
				C	<=	'1';

			when "110"	=>
				S	<=	'0';
				C	<=	'1';

			when "111"	=>
				S	<=	'1';
				C	<=	'1';

		end case;
		
	end process;

	
end arc;


별다른 것은 없고...

27번 라인, &로 signal들을 묶어 vector로 변환이 가능하다.

30번 라인, process는 순차기술문 (sequential statement) 을 제공하기 위한 기본 구조체. sensitivity list 에 포함된 signal (이 경우 k) 의 값이 변할 때마다 process 내의 문장들이 순차적으로 실행된다.

진리표를 옮길 때에는 case~when 구문이 편리하다.


다른 설계.

=========


카르노 맵을 이용하면 S, C는 다음과 같이 간소화 할 수 있다.

S = x'y'z + x'yz' + xy'z' + xyz

C = xy + xz + yz


이를 이용하여 구현.




library ieee;
use ieee.std_logic_1164.all;


entity FullAdder2_vhdl is

	port (
		x, y, z		:	in	std_logic;
		S, C		:	out	std_logic
	);
	
end FullAdder2_vhdl;


architecture arc of FullAdder2_vhdl is

	signal nx, ny, nz	:	std_logic;

begin

	nx	<=	not x;
	ny	<=	not y;
	nz	<=	not z;

--
-- S = x'y'z + x'yz' + xy'z' + xyz
-- C = xy + xz + yz
--

	S	<=	(nx and ny and z) or
			(nx and y and nz) or
			(x and ny and nz) or
			(x and y and z);

	C	<=	(x and y ) or
			(x and z) or
			(y and z);

end arc;


특이한 점은 없다.


또 다른 구현

===========




--
-- VHDL을 이용한 FPGA 디지털 설계
--  3장. 조합논리 회로의 설계
--   section 02. 전가산기
--    코드 3-5	

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;


entity FullAdder3_vhdl is

	port (
		x, y, z		:	in	integer range 0 to 1;
		S, C		:	out	std_logic
	);
	
end FullAdder3_vhdl;


architecture arc of FullAdder3_vhdl is

	signal sum	:	std_logic_vector(1 downto 0);
	
begin

	--
	-- conv_std_logic_vector 의 사용 예.
	-- 참고: conv_integer, conv_unsigned, conv_signed
	--

	process(x, y, z)
	begin
	
		sum		<=	conv_std_logic_vector(x + y + z, 2);
		
	end process;
	
	
	S	<=	sum(0);
	C	<=	sum(1);


end arc;


x, y, z를 integer 로 선언. 그리고 conv_std_logic_vector 함수를 사용하였다.

이를 위해 ieee.set_logic_arith 를 인클루드.


* 변환 함수:

conv_integer    :    unsigned, signed 또는 std_logic 값을 integer 값으로 변환한다. 이 함수의 범위는 -2147483647 ~ 2147483647 (응?) 로 31비트 unsigned 값 또는 32비트 signed 값에 해당한다.


conv_unsigned    :    변환될 비트의 수 (size bit)와 함께 integer, unsigned, signed 또는 std_ulogic을 unsigned 값으로 변환한다.


conv_signed    :    변환될 비트의 수와 함께 integer, unsigned, signed 또는 std_ulogic 값을 signed 값으로 변환한다.


conv_std_logic_vector    :    변환될 비트의 수와 함께 integer, unsigned, signed 또는 std_ulogic 값을 std_logic_vector 값으로 변환한다.


좀 더 찾아보자.

'book > VHDL을 이용한 FPGA 디지털 설계' 카테고리의 다른 글

7-segment decoder  (0) 2014.06.05
xor을 이용한 전감산기 설계  (0) 2014.06.04
xor을 이용한 전가산기 설계  (0) 2014.06.04
전감산기의 설계  (0) 2014.06.04
VHDL을 이용한 FPGA 디지털 설계  (0) 2014.06.03
Posted by 쿨한넘



노승환 지음. 한빛아카데미.

'book > VHDL을 이용한 FPGA 디지털 설계' 카테고리의 다른 글

7-segment decoder  (0) 2014.06.05
xor을 이용한 전감산기 설계  (0) 2014.06.04
xor을 이용한 전가산기 설계  (0) 2014.06.04
전감산기의 설계  (0) 2014.06.04
전가산기의 VHDL 설계  (0) 2014.06.03
Posted by 쿨한넘
dev. boards/RIoTboard2014. 5. 28. 14:52




switch                 D1  D2  D3  D4  D5  D6  D7  D8
=====================================================
serial download         0   1   x   x   x   x   x   x
SD (J16, bottom)        1   0   1   0   0   1   0   1
uSD (J17, top)          1   0   1   0   0   1   1   0
eMMC                    1   0   1   1   0   1   1   1



'dev. boards > RIoTboard' 카테고리의 다른 글

RIoT Board features  (0) 2014.05.28
Posted by 쿨한넘
dev. boards/RIoTboard2014. 5. 28. 10:31



Kit Features


The RIoTboard is based on the i.MX 6Solo processor from Freescale Semiconductor integrating all the functionalities of this multimedia application processor with the following features:

    Processor
        ARM Cortex A9 MPCore™ Processor at 1 GHz
        High-performing video processing unit which covers SD-level and HD-levelvideo decoders and SD-level encoders as a multi-standard video codec engine
        An OpenGL® ES 2.0 3D graphics accelerator with a shader and a 2D graphics accelerator for superior 3D, 2D, and user interface acceleration
    Memories
        1GByte of 32-bit wide DDR3 @ 800MHz
        4GB eMMC
    Media Interfaces
        Analog headphone/microphone, 3.5mm audio jack
        LVDS interface
        HDMI interface
        Parallel RGB interface
        Camera interface (Support CCD or CMOS camera)
        MIPI lanes at 1 Gbps
    Data Transfer Interfaces
        Debug Ports: 3 pin TTL level
        Serial Ports:
            UART2, 3 line serial port, RS232 Logic
            UART3,4,5, 3 line serial port, RS232 Logic (Expansion port)
        USB Ports:
            1 x USB2.0 OTG, mini USB, high-speed, 480Mbps
            4 x USB2.0 HOST, Type A, high-speed, 480Mbps
        uSD card interface
        SD card interface
        10M/100M/Gb Ethernet Interface (RJ45 jack)
        2 channel I2C interface (Expansion port)
        2 channel SPI interface (Expansion port)
        3 channel PWM interface (Expansion port)
        GPIO (Expansion port)
    Input Interfaces
        10-pin JTAG interface
        Boot configuration interface
    Others
        1 Power LED
        1 Open SDA LED
        2 User-defined LEDs
        1 DC Jack
        1 Reset button

'dev. boards > RIoTboard' 카테고리의 다른 글

boot mode select with dip switches  (0) 2014.05.28
Posted by 쿨한넘
dev. boards/epm240 mini2014. 5. 23. 13:30

max II,  max V 계열 cpld 내부엔 oscillator 가 있다. 이 오실레이터의 테스트.

altera 홈페이지에서 AN 496: Using the Internal Oscillator in MAX II and MAX V CPLDs 를 참조했고, vhdl을 이용하여 테스트.

간단히하면, tool -> MegaWizard Plug-In Manager 선택. I/O에서 MAX II / MAX V Oscillator 선택. 그리고 오실레이터 이름 정하기. 여기에선 intOSC 로 이름지어 생성했다. 아래 코드는 이 오실레이터와의 인터페이스 예제.


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;


entity epm240_test_red is

	port (
		clk			:	in	std_logic;
		cout		:	out	std_logic;
		intosc_out	:	out	std_logic
	);

end epm240_test_red;


architecture arc of epm240_test_red is

	signal value			:	integer range 0 to 50000000;
	signal led				:	std_logic;

	signal	int_osc_out		:	std_logic;
	signal	int_count		:	integer range 0 to 50000000;
	signal	int_out			:	std_logic;

	component intOSC is
		port (
			oscena		:	in	std_logic;
			osc			:	out	std_logic
		);
	end component;

begin

	process(clk)
	begin
	
		if (clk'event and clk = '1') then
		
			value <= value + 1;
			
			if (value = 10000000) then
				value <= 0;
				led <= not led;
			end if;
			
		end if;

	end process;

	
	OSC2: intOSC
		port map (
			oscena	=>	'1',
			osc		=>	int_osc_out
		);
	

	process(int_osc_out)
	begin
	
		if (int_osc_out'event and int_osc_out = '1') then
		
			int_count <= int_count + 1;
			
			if (int_count = 500000) then
				int_count <= 0;
				int_out <= not int_out;
			end if;	
			
		end if;

		end process;

	
	cout <= led;
	intosc_out <= int_out;

end arc;



'dev. boards > epm240 mini' 카테고리의 다른 글

epm240 modules specifications  (0) 2014.05.23
epm240t100 modules  (0) 2014.05.23
Posted by 쿨한넘
dev. boards/epm240 mini2014. 5. 23. 12:18

# epm240 mini red

50MHz osc at pin# 64


# epm240 mini blue

50MHz osc at pin# 12

LED at pin# 77 (J2 점퍼 off 로 연결 해제)


'dev. boards > epm240 mini' 카테고리의 다른 글

epm240 internal oscillator test  (0) 2014.05.23
epm240t100 modules  (0) 2014.05.23
Posted by 쿨한넘
dev. boards/epm240 mini2014. 5. 23. 11:37


ebay에서 구매한 대륙의 모듈. 싸구려 티가 풀풀 나지만, 역시 거부할 수 없는 가격.


epm240 mini red 라 부르기로 한 모듈은,

가격은 9불, EPM240T100C5N 가 달려있다.


epm240 mini blue 라 정한 모듈은,

가격 10불에 두개를 샀는데 하나는 EPM240T100C4N 가, 다른 하나는 EPM240T100C5N 가 달려있다.



'dev. boards > epm240 mini' 카테고리의 다른 글

epm240 internal oscillator test  (0) 2014.05.23
epm240 modules specifications  (0) 2014.05.23
Posted by 쿨한넘