embeded/FPGA - ALTERA2018. 1. 2. 10:41

FPGA를 이용해서 MIPS나 RISC-V를 구현해서 SW CPU로

AVR 이나 STM32 대신 쓰도록 하는 프로젝트 인 듯?


[링크 : http://www.nxlab.fer.hr/fpgarduino/]

Posted by 구차니
embeded/FPGA - ALTERA2018. 1. 1. 18:02

NOR 플래시의 경우에는 256byte당 5ms 쉬어 주어야 하는 것 때문에 느릴 수 밖에 없다. 

라는데..일단 artix-7 에서 8분 정도 걸린다고 하고..

[링크 : https://forums.xilinx.com/t5/7-Series-FPGAs/Artix-7-configuration-flash-programming-time/td-p/817714]


이번에 구매한 altera Cyclone IV, DE0-Nano는 프로그램이 크지 않겠지만

sof 파일 자체는 700KB로 거의 동일한데

플래시 자체는 8MB 짜리이고 회사에서 쓴느건 16MB 짜리인데

굽는 시간이 너무 차이난다.


de0-nano를 구울때 길어야 2초?

회사에서 artix-7은 한 체감 10분은 걸린거 같은데..


도대체 무슨 차이일까?


일단..DE0-Nano에 것도 NOR 플래시인데...

도대체 왜이렇게 굽는 속도가 심하게 차이가 날까?

[링크 : http://www.macronix.com/...Flash%20Cross%20Reference%20Guide.pdf]

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


Micron Serial NOR Flash Memory 3V, Multiple I/O, 4KB, 32KB, 64KB, Sector Erase MT25QL128ABA

[링크 : https://www.micron.com/.../mt25q/die-rev-a/mt25q_qlhs_l_128_aba_0.pdf]


+

2018.01.02

지금까지 sof로 쓴거라 SRAM에 후다닥... -_-

즉 플래시에 써본적이 한번도 없었네? 라는 반전 두둥!

어찌어찌 플래시에 쓰는데 그래도 빠르다?

일단 artix-7이 더 클거 같긴한데.. cyclone 4는 한 30초 이내로 700KB가 써지는 느낌이라 빠르긴 빠른 듯

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

altera EPCS controller  (0) 2018.01.02
de0-nano arduino...?  (0) 2018.01.02
terasic DE0-Nano Control Panel 실행오류  (0) 2017.12.31
de0-nano + W5100 Ethernet Shield(arduino)  (0) 2017.12.29
de0-nano + rpi = 채굴머신..  (0) 2017.12.29
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 31. 20:17

control panel 이라는거 한번 실행해보려니 에러가 뿜뿜

검색하다 보니.. 일단은 내가 신버전을 설치해서 문제가 생긴거 같고

jtag_client.dll은 아래 경로에 존재는 하는데 복사해서 control panel 과 동일한 경로에 복사해도 안된다.

C:\intelFPGA_lite\17.1\quartus\bin64 


해결 방법은.. 아마도(?)

64bit 신버전 quartus 설치한 것이 원인으로 보이는데

dll 을 다운로드 받아 보면 bin32에 압축을 풀라고 되어있고

이거 하나 quartus 아래에 복사해주면 아무런 문제없이 실행이 된다.


Running Control Panel under Quartus II 15.0 or later version

[링크 : http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&No=293

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

[링크 : http://mail.terasic.com.cn/~wyzhou/bin32.zip] dll 다운로드


프로그램이 이상한건진 모르겠지만 한 0.5초 정도에서 1초 정도의 딜레이 이후에

변경사항이 적용된다.(LED도 늦게 바뀌고, 스위치도 늦게 인식하고)


올리고 나서 켜보니 신기한거 발견

FPGA의 EPCS에 쓰는게 아니라

전원을 차단했다가 켜니 이전 상태로 돌아온다.

내부 램(?)에 바로 써서 그런 듯?

Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 29. 13:04

de0-nano 지르면서 덤으로 준 항목에

W5100 칩셋 사용하는 아두이노 이더넷 실드가 있는데

이거랑 FPGA에 nios2를 연동하는 예제를 발견!


[링크 : http://www.fpgalover.com/ip-cores/wiznet-5100-core]


아두이노 에서 이더넷 실드 사용법

일단.. W5100이 SPI 통신인가 보네.. 순수하게 FPGA로 SPI IP 이용해서 통신이 가능하려나?

[링크 : http://www.instructables.com/id/Arduino-Ethernet-Shield-Tutorial/]

[링크 : https://blog.naver.com/rnc_ohm/220021888182]

[링크 : https://kocoafab.cc/tutorial/view/291]

Posted by 구차니
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 구차니