embeded/FPGA - ALTERA2017. 12. 29. 12:46

FPGA로 채굴하는 이야기는 들었는데

막상 장비가 다 갖춰지니 시험삼아 어떻게 돌아가는지 정도 호기심에

해볼까? 라는 생각이 드네


비트코인 채굴하는건 UART로 통신 하는걸로 보이고..

In the mining rig described here an FPGA does all the hard work (SHA-256 hashing) and communicates over a serial link with a Raspberry Pi

[링크 : https://www.rs-online.com/designspark/bitcoin-mining-with-a-raspberry-pi-and-de0-nano]

[링크 : https://github.com/progranism/Open-Source-FPGA-Bitcoin-Miner]


시리얼

Plug GPIO03 on the DE0-Nano into GPIO 15 on the Raspberry Pi.

Plug GPIO05 on the DE0-Nano into GPIO 14 on the Raspberry Pi.

-> 요건 보니.. RS-232/UART로 연결하는거 같고


패러럴

Plug GPIO 133 on the DE0-Nano into GPIO 8 on the Raspberry Pi

Plug GPIO 131 on the DE0-Nano into GPIO 10 on the Raspberry Pi

Plug GPIO 129 on the DE0-Nano into GPIO 24 on the Raspberry Pi

Plug GPIO 127 on the DE0-Nano into GPIO 4 on the Raspberry Pi

Plug GPIO 125 on the DE0-Nano into GPIO 17 on the Raspberry Pi

Plug GPIO 132 on the DE0-Nano into GPIO 22 on the Raspberry Pi

Plug GPIO 130 on the DE0-Nano into GPIO 9 on the Raspberry Pi

Plug GPIO 128 on the DE0-Nano into GPIO 25 on the Raspberry Pi

Plug GPIO 126 on the DE0-Nano into GPIO 18 on the Raspberry Pi

Plug GPIO 124 on the DE0-Nano into GPIO 23 on the Raspberry Pi

-> 요건.. 8비트 병렬 전송+2비트 제어로 순수 GPIO 제어인듯..

[링크 : http://catherineh.github.io/programming/2016/11/15/raspberry-pi-to-fpga-communication-example]


+

전반적으로 라즈베리와 통신하는게 딱히 이렇다할 고속 인터페이스가 없다 보니 어쩔수 없는 건가...

Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 29. 08:41

설치해 놓은 quartus 처음 실행하니 이런거 뜨네?

일단은 걍 실행


DE0_NANO_default

KEY0를 누르면 타이밍에 따라 오작동 하는 것으로 보이는 경우가 있어서  살짝 수정

(오른쪽 LED가 밝아진 후에 KEY0를 누르면 LED0 만 꺼지고 나머지는 유지됨)


그나저나 빌드는 한참 걸리는건 매한가지구만 ㅠㅠ


메뉴 뒤지다 보니 보이는 Pin Planner.

이것도 나중에는 하나하나 해봐야 하는거구만 ㅠㅠ


작성한 프로그램을 업로드 하는 Programmer

Hardware Setup에서 설치된 JTAG 골라주고 Start 누르면 끝!


DE0_NANO_GSensor

얘는 IP 사용중인게 있는지 업데이트 하라고 한다.

Upgrade in Editor가 활성화 되길래 눌렀는데


이거 머야.. 무서워 -_ㅠ cancel 누르고 후퇴!


Perform Automatic upgrade가 최고야 ㅠㅠ


먼가 소스가 보이네.. 일단 빌드하고


막 누르다 보니 vivado에서 보던 신기한거 발견

확대하면 먼가 다른 신기한게 막 나오는데,

자일링스 것 처럼 먼가 자세하게 칩 내부 까지 보이는건 아닌거 같기도 하고..


SPI COUNT~3 에 대한 부분이 여기 있다~ 라는거 정도인가?

schematic이 같이 나와서 먼가 있어 보긴 하네


my_first_fpga

아까 캡쳐 못했던 IP upgrade recommended 메시지 찰칵!


auto upgrade가 하나만 뜨네.. 결국에는 Upgrade in Editor를 해야 하는건가 ㅠㅠ



아 몰라.. 그냥 무조건 Next ㅋㅋ





오.. VHDL이나 Verilog가 아니라 그냥 schematic이 나오네?


빌드해서 돌려보니 KEY0 누르면 빠르게 카운터가 증가함

'embeded > FPGA - ALTERA' 카테고리의 다른 글

de0-nano + W5100 Ethernet Shield(arduino)  (0) 2017.12.29
de0-nano + rpi = 채굴머신..  (0) 2017.12.29
DE0-nano 기본 프로그램 분석  (0) 2017.12.28
terasic DE0-Nano 부품들  (0) 2017.12.27
quartus2 설치 + usb blaster 설치  (0) 2017.12.27
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 28. 13:00

큭... VHDL 공부 하는데 Verilog 라니.. 비겁하다!!!


// ============================================================================ // Copyright (c) 2011 by Terasic Technologies Inc. // ============================================================================ // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic Development Boards and Altera Development // Kits made by Terasic. Other use of this code, including the selling // ,duplication, or modification of any portion is strictly prohibited. // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference // which illustrates how these types of functions can be implemented. // It is the user's responsibility to verify their design for // consistency and functionality through the use of formal // verification methods. Terasic provides no warranty regarding the use // or functionality of this code. // // ============================================================================ // // Terasic Technologies Inc // 356 Fu-Shin E. Rd Sec. 1. JhuBei City, // HsinChu County, Taiwan // 302 // // web: http://www.terasic.com/ // email: support@terasic.com // // ============================================================================ // Major Functions/Design Description: // // Please refer to DE0_Nano_User_manual.pdf in DE0_Nano system CD. // // ============================================================================ // Revision History: // ============================================================================ // Ver.: |Author: |Mod. Date: |Changes Made: // V1.0 |EricChen |02/01/2011 | // ============================================================================ //======================================================= // This code is generated by Terasic System Builder //======================================================= module DE0_NANO( //////////// CLOCK ////////// CLOCK_50, //////////// LED ////////// LED, //////////// KEY ////////// KEY, //////////// SW ////////// SW, //////////// SDRAM ////////// DRAM_ADDR, DRAM_BA, DRAM_CAS_N, DRAM_CKE, DRAM_CLK, DRAM_CS_N, DRAM_DQ, DRAM_DQM, DRAM_RAS_N, DRAM_WE_N, //////////// EPCS ////////// EPCS_ASDO, EPCS_DATA0, EPCS_DCLK, EPCS_NCSO, //////////// Accelerometer and EEPROM ////////// G_SENSOR_CS_N, G_SENSOR_INT, I2C_SCLK, I2C_SDAT, //////////// ADC ////////// ADC_CS_N, ADC_SADDR, ADC_SCLK, ADC_SDAT, //////////// 2x13 GPIO Header ////////// GPIO_2, GPIO_2_IN, //////////// GPIO_0, GPIO_0 connect to GPIO Default ////////// GPIO_0_D, GPIO_0_IN, //////////// GPIO_0, GPIO_1 connect to GPIO Default ////////// GPIO_1_D, GPIO_1_IN, ); //======================================================= // PARAMETER declarations //======================================================= //======================================================= // PORT declarations //======================================================= //////////// CLOCK ////////// input CLOCK_50; //////////// LED ////////// output [7:0] LED; //////////// KEY ////////// input [1:0] KEY; //////////// SW ////////// input [3:0] SW; //////////// SDRAM ////////// output [12:0] DRAM_ADDR; output [1:0] DRAM_BA; output DRAM_CAS_N; output DRAM_CKE; output DRAM_CLK; output DRAM_CS_N; inout [15:0] DRAM_DQ; output [1:0] DRAM_DQM; output DRAM_RAS_N; output DRAM_WE_N; //////////// EPCS ////////// output EPCS_ASDO; input EPCS_DATA0; output EPCS_DCLK; output EPCS_NCSO; //////////// Accelerometer and EEPROM ////////// output G_SENSOR_CS_N; input G_SENSOR_INT; output I2C_SCLK; inout I2C_SDAT; //////////// ADC ////////// output ADC_CS_N; output ADC_SADDR; output ADC_SCLK; input ADC_SDAT; //////////// 2x13 GPIO Header ////////// inout [12:0] GPIO_2; input [2:0] GPIO_2_IN; //////////// GPIO_0, GPIO_0 connect to GPIO Default ////////// inout [33:0] GPIO_0_D; input [1:0] GPIO_0_IN; //////////// GPIO_0, GPIO_1 connect to GPIO Default ////////// inout [33:0] GPIO_1_D; input [1:0] GPIO_1_IN; //======================================================= // REG/WIRE declarations //======================================================= wire reset_n; reg [26:0] counter; reg [5:0] PWM_adj; reg [6:0] PWM_width; reg [7:0] LED; //======================================================= // Structural coding //======================================================= assign reset_n = KEY[0]; always @(posedge CLOCK_50 or negedge reset_n) begin if(!reset_n) begin counter <= 0; LED[0] <= 0; end else begin counter <= counter+1; PWM_width <= PWM_width[5:0]+ PWM_adj; if(counter[26]) begin PWM_adj <= counter[25:20]; end else begin PWM_adj <= ~ counter[25:20]; end LED[0] <= ~PWM_width[6]; LED[1] <= ~PWM_width[6]; LED[2] <= ~PWM_width[6]; LED[3] <= ~PWM_width[6]; LED[4] <= PWM_width[6]; LED[5] <= PWM_width[6]; LED[6] <= PWM_width[6]; LED[7] <= PWM_width[6]; end end endmodule 


일단.. 눈에 들어오는 키워드는

begin - end 구조 동일해 보이고..

postedge CLOCK_50 으로 50Mhz OSC입력을 positive edge 니까.. rising edge일려나?

negedge reset_n 이니까.. KEY_0를 RESET_N으로 맵핑했고(작동이 그러니까..)

그게 falling edge로 잡히면 트리거 되서 작동하는데

!reset_n이면 카운터와 LED[0]을 0으로 각각 셋팅(LED 0번만 끄고 counter를 0으로 설정)

reset_n이면

카운터(27비트 = 134,217,728)를 증가하면서 PWM_Width 값을 더해주는데

카운터의 MSB가 1이 되면 (67,108,864 초과) counter의 25~20번째 비트를 복사하고

0이면 counter의 25~20번째 비트를 negate 시켜서 (그러니까 감소) 복사한다.

그래서 LED[0:7] 에 PWM_width를 입력해 주는데

가장 상위 비트만 출력함으로서

0과 1을 50Mhz에 연동해서 빠르게 on/off 함으로서 PWM을 구현하게 되는건가?



+

posedge means the transition from 0 to 1

negedge the oposit transition from 1 to 0

그러니까.. posedge는 rising edge고, negedge는 falling edge가 맞겠네?

[링크 : http://www.alteraforum.com/forum/showthread.php?t=19611]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

de0-nano + rpi = 채굴머신..  (0) 2017.12.29
de0-nano 기본 예제 올려봄  (0) 2017.12.29
terasic DE0-Nano 부품들  (0) 2017.12.27
quartus2 설치 + usb blaster 설치  (0) 2017.12.27
de0-nano LED 예제  (0) 2017.12.27
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 27. 21:40

ALTERA EP4C EP4CE22F17C6N Cyclone IV - U1

[링크 : https://www.altera.com/.../global/en_US/pdfs/literature/hb/cyclone-iv/cyiv-51001.pdf


SPANSION FL064PIF 64MBit(8MB) 3.0V SPI FLASH - U9 - EPCS64

악의적이라고 해야하나? 메뉴얼에는 단위가 통일되어 있지 않다.

[링크 : http://www.cypress.com/file/196856/download]


ISSI IS42S16160G-7TLI 256Mb(32MB) SDRAM - U5

[링크 : http://www.issi.com/WW/pdf/42-45S83200G-16160G.pdf]


microchip 24LC02B 2K i2c eeprom - U6

얜... 용도가 멀까? i2c 테스트용?

I2C address 0xA0

[링크 : http://ww1.microchip.com/downloads/en/DeviceDoc/21709c.pdf]


Ti SN74AUC17 슈미트 트리거 버퍼(스위치용) - U2

[링크 : http://www.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=SN74AUC17&fileType=pdf]


ADXL345 디지털 가속도계 - U3

[링크 : http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL345.pdf


Ti ADC128S022 8ch, 50kSPS~200kSPS, 12bit ADC - U4

[링크 : http://www.ti.com/general/docs/lit/...genericPartNumber=ADC128S022...pdf


LDO

[링크 : http://www.ti.com/lit/ds/symlink/lp5900.pdf] 3.3V / 1.2V

[링크 : http://www.ti.com/lit/ds/symlink/lp38500-adj.pdf] 2.5V


---

아래 두개는 schematic에서 누락된 부분. USB Blaster 구성품으로 추측된다.


ALTERA EPM240M100C4N MAX II 시리즈 - U8

용도불명 -ㅁ-

[링크 : https://www.altera.com/en_US/pdfs/literature/dp/max2/epm240z.pdf]


FDTI FT245BL - U7

USB to Parallel?

[링크 : http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT245BL.pdf]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

de0-nano 기본 예제 올려봄  (0) 2017.12.29
DE0-nano 기본 프로그램 분석  (0) 2017.12.28
quartus2 설치 + usb blaster 설치  (0) 2017.12.27
de0-nano LED 예제  (0) 2017.12.27
altera 교육자료 요약  (0) 2017.12.27
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 27. 20:48

Quartus Lite 17.1.0.590을 받으면서

ModelSim 도 같이 받았는데 음.. Quartus에 일정부분은 포함되어 있나 보네

그리고 Cyclone IV만 포함되어 있는데.. 내가 선택한건가? 왜 이거 뿐이지?



다 깔고나서 USB Blaster 2 설치하도록 하네..


Altera(WinUSB) JTAG cables라는 이름으로 심심하게(?) 깔린다.


근데 얘는 다른거고.. DE0-nano는 usb blaster라 인식을 안하니까

quartus 2 기본값 설치시 C:\intelFPGA_lite\17.1\quartus\drivers 하위에 드라이버가 존재하고

USB Blaster를 통해 설치하면 된다.

[링크 : https://www.altera.com/support/support-resources/download/drivers/usb-blaster/dri-usb-blaster-vista.html]


+

2017.12.28

tersaic de0-nano\Demonstration\EPCS_Patch\nios2-flash-override.txt

위의 파일은

C:\intelFPGA_lite\17.1\nios2eds\bin 에 복사해주면 된다고 함.

[링크 : https://blog.naver.com/acidc/220616936189]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

DE0-nano 기본 프로그램 분석  (0) 2017.12.28
terasic DE0-Nano 부품들  (0) 2017.12.27
de0-nano LED 예제  (0) 2017.12.27
altera 교육자료 요약  (0) 2017.12.27
GHDL - 시뮬레이터  (0) 2017.12.26
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 27. 13:48

카페자료 퍼옴..

그나저나 이거 언제 해보려나..


VHDL 코드나 일단 한줄한줄 분석해보고

글 쓰신분에게 코드 복사해가도 되나 물어 봐야겠다..


[링크 : http://cafe.naver.com/alteratown/6574]



syntax highlight(notepad++) 하니 굳이 주석 안달아도 될 느낌?

library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; use ieee.numeric_std.all; entity led_top is Port ( p_clk_50Mhz : in std_logic; p_button : in std_logic_vector( 1 downto 0 ); p_led_out : out std_logic ); end led_top; architecture Behavioral of led_top is signal s_reset : std_logic; signal s_clk_50Mhz_cnt : std_logic_vector( 15 downto 0 ); signal s_clk_1Khz : std_logic := '0'; signal s_clk_1Khz_cnt : std_logic_vector( 15 downto 0 ); begin -- reset 신호 생성 s_reset <= not p_button(0); -- 분주 타이머 process( s_reset, p_clk_50Mhz ) is begin if rising_edge( p_clk_50Mhz ) then if s_reset = '1' then s_clk_50Mhz_cnt <= ( others => '0' ); else if s_clk_50Mhz_cnt = (50000-1) then s_clk_1Khz <= not s_clk_1Khz; s_clk_50Mhz_cnt <= ( others => '0' ); else s_clk_50Mhz_cnt <= s_clk_50Mhz_cnt + 1; end if; end if; end if; end process; process( s_reset, s_clk_1Khz ) is begin if rising_edge( s_clk_1Khz ) then if s_reset = '1' then s_clk_1Khz_cnt <= ( others => '0' ); else s_clk_1Khz_cnt <= s_clk_1Khz_cnt + 1; end if; end if; end process; p_led_out <= s_clk_1Khz_cnt(7);  

end Behavioral; 


'embeded > FPGA - ALTERA' 카테고리의 다른 글

terasic DE0-Nano 부품들  (0) 2017.12.27
quartus2 설치 + usb blaster 설치  (0) 2017.12.27
altera 교육자료 요약  (0) 2017.12.27
GHDL - 시뮬레이터  (0) 2017.12.26
c to HDL ㄷㄷㄷ  (0) 2017.12.22
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 27. 09:00

모 카페에 가입해서 받은 내용정리


개발흐름

ModelSim - RTL Simulation

Quartus2 - Synthesis / Place & Route, Timimg analysis

ModelSim - Timing Simulation


ModelSim 2000달러.. ㄷㄷㄷ

[링크 : https://www.altera.com/products/design-software/model---simulation/modelsim-altera-software.html]

Mentor 사의 프로그램인데 altera quartos에 통합한 듯

[링크 : https://en.wikipedia.org/wiki/ModelSim]



MAX 시리즈 - CPLD

Stratix 시리즈 - 고밀도, 고성능 (2002)

Cyclone 시리즈 - Lost Cost... (2003)

Arria 시리즈 - Low Cost 트랜시버

Hardcopy 시리즈 - ASIC

(고성능 버전 만들고 염가형을 만드는게 당연한거였나?)


ALTERA Cyclone 시리즈

Cyclone 1은 NIOS, DDR

Cyclone 2 부터 NIOS2, DDR2 지원

Cyclone V 부터 DDR3

[링크 : https://www.altera.com/en_US/pdfs/literature/hb/cyclone-v/cv_51001.pdf]


(음? 전부 LUT 기반인줄 알았는에 아니었나?)

Product Term Based Building Blocks

- EEPROM 기반 - 비휘발성

- XOR 게이트 (합성용)

- 프로그래머블 AND, 고정 OR 어레이


LUT Based Building Blocks

- SRAM 기반, 휘발성 (CPLD는 비휘발성)

- LUT를 통해 원하는 기능 구현 가능(n-Input AND, n-Input XOR)


칩 구조에서 M512 M4K/M9K 이런게 보여서 검색

[링크 : https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/ug/ug_ram.pdf]


RTL

단순용어와는 다르게 RTL 이라고 표현하면 대개 HDL 언어로 기술된걸 의미하는 듯

[링크 : https://en.wikipedia.org/wiki/Register-transfer_level]


Qsys : SOPC builder

- SoPC Builder (System on a Programmable Chip Builder) 

SOPC Builder, a tool in Quartus II software that eliminates manual system integration tasks by automatically generating interconnect logic and creating a testbench to verify functionality

Qsys, a system-integration tool that is the next generation of SOPC Builder. It uses an FPGA-optimized network-on-chip architecture that doubles the fMAX performance vs. SOPC Builder. 

[링크 : https://en.wikipedia.org/wiki/Altera_Quartus]


'embeded > FPGA - ALTERA' 카테고리의 다른 글

quartus2 설치 + usb blaster 설치  (0) 2017.12.27
de0-nano LED 예제  (0) 2017.12.27
GHDL - 시뮬레이터  (0) 2017.12.26
c to HDL ㄷㄷㄷ  (0) 2017.12.22
FPGA IP 관련..  (0) 2017.12.22
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 26. 14:39

혹시나 해서 오픈소스로 bitstream 파일을 뱉어내는 vhdl 컴파일러(?)가 있는지 찾아 보는데

아무래도 업체 종속적이다 보니 합성은 안되고

시뮬레이션 정도만 되는게 한계인 듯..


[링크 : http://ghdl.free.fr/]

[링크 : https://github.com/ghdl/ghdl]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

de0-nano LED 예제  (0) 2017.12.27
altera 교육자료 요약  (0) 2017.12.27
c to HDL ㄷㄷㄷ  (0) 2017.12.22
FPGA IP 관련..  (0) 2017.12.22
염가형(?) FPGA evaluation 보드  (0) 2017.12.20
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 22. 17:42

'embeded > FPGA - ALTERA' 카테고리의 다른 글

altera 교육자료 요약  (0) 2017.12.27
GHDL - 시뮬레이터  (0) 2017.12.26
FPGA IP 관련..  (0) 2017.12.22
염가형(?) FPGA evaluation 보드  (0) 2017.12.20
altera quartus 라이센스 관련  (0) 2017.12.19
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 22. 15:55

심심해서(?) 지른기념으로(?!) 찾아봤는데

괜히 자일링스 많이 사용하는게 아닌 듯..


확실히 이것저것 키워드 넣어서 검색해보면 자일링스 쪽이 다양하게 잘 뜬다.

[링크 : https://www.xilinx.com/products/intellectual-property.html]

[링크 : https://www.altera.com/products/intellectual-property/ip.html]

'embeded > FPGA - ALTERA' 카테고리의 다른 글

GHDL - 시뮬레이터  (0) 2017.12.26
c to HDL ㄷㄷㄷ  (0) 2017.12.22
염가형(?) FPGA evaluation 보드  (0) 2017.12.20
altera quartus 라이센스 관련  (0) 2017.12.19
망할 지름신님...  (0) 2017.12.14
Posted by 구차니