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 구차니
embeded/FPGA - ALTERA2017. 12. 20. 15:23

이럴때는 한국에 사는게 아쉬움..

외국에는 가짓수도 많고 싸보이는데.. ㅠㅠ

[링크 : https://joelw.id.au/FPGA/CheapFPGADevelopmentBoards]


여전이 고민중이지만.. 가격상의 문제로

Altera Cyclone 4. V관련해서는

DE1-SoC나 DE0-SoC는 좀 많이 무리고 (한 20?)

DE0-Nano가 무난하긴 한데, DIP 스위치랑 LED, 버튼식 스위치 2개 있는게 다라서 조금 고민

개인적인 욕심이지만 랜 정도는 달리면 좋겠는데 욕심일 뿐이려나?


Zynq 관련해서는

Parallella 인가 이건 영 구할데가 없고 (한 13.. 근데 판매종료인데..)

Zybo는 매물이 안보이고 (한 15?)

Zedboard 는 심하게 비싸고 ㅠㅠ (한 30?)


Artix-7 관련해서는

Arty-7 정도가 보이는데.. 가격을 물어봐야 하는 귀차니즘이..(한 10?)

다만 얘는 랜도 달렸고. xilinx니까 microblaze도 해볼 수 있으니


랜을 포기하고 de0-nano로 시작해서 나중에 arty-7 구해서 양쪽다 다뤄보는게 나을려나?



+

de0-nano나 arty-7 35T나 둘다, USB 전원으로 충분하고, 외부 전원은 optional이다.


arty에는 ETH phy도 있고.. 램도 넉넉하고 LED랑 스위치가 좀더 많아서 가지고 놀기에는 좋아 보이네..


[링크 : https://reference.digilentinc.com/reference/programmable-logic/arty/reference-manual?redirect=1]

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

c to HDL ㄷㄷㄷ  (0) 2017.12.22
FPGA IP 관련..  (0) 2017.12.22
altera quartus 라이센스 관련  (0) 2017.12.19
망할 지름신님...  (0) 2017.12.14
ASSP - Application-specific standard product  (0) 2017.12.14
Posted by 구차니
embeded/FPGA - ALTERA2017. 12. 19. 15:06

특이하게도 Standard가 가장 많은 걸 지원하되, 하이엔드 급은 빠지고

Pro는 하이엔드만 지원하고,

웹버전(lite)는 standard와 유사하지만, 일부 메인스트림급(엔트리 상급)은 빠지는 식인 듯

[링크 : http://dl.altera.com/devices/] 버전별 지원 칩셋 목록


버전별로 Nios II EDS 포함한 Quartus Prime은 공통으로 포함

openCL은 lite에서는 빠짐

[링크 : https://www.altera.com/downloads/software/archives/arc-index.html]

    [링크 : http://dl.altera.com/16.1/?edition=lite] lite 버전(web)

    [링크 : http://dl.altera.com/16.1/?edition=standard] standard 버전

    [링크 : http://dl.altera.com/16.1/?edition=pro] pro 버전


lite만 no license required..

[링크 : https://www.altera.com/downloads/download-center.html]

[링크 : https://www.altera.com/support/support-resources/download/licensing/q-and-a.html]


300~400 만원 정도는 우습게 넘겠네 ㄷㄷ

[링크 : https://www.altera.com/buy/design-software.html]

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

FPGA IP 관련..  (0) 2017.12.22
염가형(?) FPGA evaluation 보드  (0) 2017.12.20
망할 지름신님...  (0) 2017.12.14
ASSP - Application-specific standard product  (0) 2017.12.14
FPGA IP?  (0) 2017.12.11
Posted by 구차니