Programming/Verilog2018. 1. 19. 07:51

reduction operator는

벡터에 대해서 1개의 bit로 연산을 해준다.

가장 편리한(?) 예제로는 parity 계산

bitwise and를 비트별로 계산할걸 reduction을 쓰면 한번에 끝난다.

근데 bitwise 연산자랑 일항 축약 연산자랑 어떻게 구분하지?


unary reduction operator

reg r_C;

&4'b1101;

r_C = |4'b0010;

[링크 : https://www.nandland.com/verilog/examples/example-reduction-operators.html]


bitwise operator

reg r_A = 1'b1;

reg r_B = 1'b0;

assign w_AND_SCALAR = r_A & r_B;

[링크 : https://www.nandland.com/verilog/examples/example-bitwise-operators.html]



+

아.. 그래서 unary 연산자 였군..

어떻게 보면 포인터와 비슷한 방식으로 단항으로 사용이 되고

항이 두개면 무조건 bitwise로 연산이 되려나?

즉, reduction은 무조건 변환 후 대입 정도만 허용되고

bitwise는 두항을 계산하고 2다른 걸 연속적으로 하는 식이 가능 할 것으로 보인다.


+

https://www.utdallas.edu/~akshay.sridharan/index_files/Page5212.htm

'Programming > Verilog' 카테고리의 다른 글

verilog 모델링 유형  (0) 2018.01.20
verilog Concatenation, Replication operator  (0) 2018.01.19
베릴로그 순차적 구조적  (2) 2018.01.18
structural vs behavioral verilog  (0) 2018.01.12
verilog vector instance  (0) 2018.01.09
Posted by 구차니
Programming/Verilog2018. 1. 18. 20:46

blocking /non-blocking 

= 이냐 <= 이냐 차이인데

대입순서에 따라 최적화 하면 중간 결과가 사라지거나 클럭에 따라 쉬프트로 구현됨


[링크 : http://multilab.jbnu.ac.kr/2915]

[링크 : https://blog.naver.com/mikael2010/130094384689]

[링크 : http://www.sutherland-hdl.com/papers/1996-CUG-presentation_nonblocking_assigns.pdf]




+

여전히 프로그래밍 모델을 확실히 파악한게 아니라

behavioral 이라던가 procedural이라던가 

non-blocking이라던가 blocking이라던가

여러개가 혼재되서 무진장 혼동된다.

'Programming > Verilog' 카테고리의 다른 글

verilog Concatenation, Replication operator  (0) 2018.01.19
verilog unary reduction operator와 bitwise operator  (0) 2018.01.19
structural vs behavioral verilog  (0) 2018.01.12
verilog vector instance  (0) 2018.01.09
verilog always  (0) 2018.01.01
Posted by 구차니
Programming/Verilog2018. 1. 12. 13:28

함수 만들듯 verilog module을 만들어서

KEY 누르면 LED에 AND OR 연산해서 보여주려고 했더니

이상한 오류들이 뿜뿜하는 바람에 찾아 봤더니

module로 해서 구조적(함수 콜하듯)으로 사용할 때에는 wire로 된 값을 넘겨 주어야 하는 듯?

[링크 : https://blog.naver.com/bungkun1349/220337637928]

[링크 : https://blog.naver.com/specialist0/220777659022]


There is no strict definition of these terms, according to the IEEE Std. However, customarily, structural refers to describing a design using module instances (especially for the lower-level building blocks such as AND gates and flip-flops), whereas behavioral refers to describing a design using always blocks.

Gate netlists are always structural, and RTL code is typically behavioral. It is common for RTL to have instances of clock gates and synchronizer cells. 

[링크 : https://stackoverflow.com/.../what-is-the-difference-between-structural-verilog-and-behavioural-verilog]


11. Structural vs. Behavioral Verilog

To clarify the difference between structural and behavioral verilog: 
Structural verilog is composed of module instances and their interconnections (by wires) only.  The use of regs, explicit time delays, arithmetic expressions, procedural assignments, or other verilog control flow structures are considered behavioral verilog.

As stated earlier, your project code will consist primarily of structural verilog.  You will use behavioral statements for debugging purposes only.  In fact, you will probably only instantiate two regs in your whole design: one for the clock and one for a RESET signal that is asserted at the beginning of your simulation.

This section has described all of the Verilog functionality you will need for your final project.   If you want more information on behavioral Verilog, try reading the Bucknell CSCI Verilog Manual or the verilog manual at The University of Edinburgh. 

[링크 : http://users.ece.utexas.edu/~patt/04s.382N/tutorial/verilog_manual.html#11. Behavioral Verilog]

'Programming > Verilog' 카테고리의 다른 글

verilog unary reduction operator와 bitwise operator  (0) 2018.01.19
베릴로그 순차적 구조적  (2) 2018.01.18
verilog vector instance  (0) 2018.01.09
verilog always  (0) 2018.01.01
verilog 2001 ** 연산자  (0) 2018.01.01
Posted by 구차니
Programming/Verilog2018. 1. 9. 20:52

verilog 언어로 된 모듈을 여러개 어떻게 생성하나

일일이 이름 바꾸어서 해야 하나 고민을 했는데

동일 이름으로 생성도 가능하고

벡터로 모듈 생성이 가능하다고 한다

(그러니까 SHA256 모듈을 벡터로 생성하는 꽁수를!)


Example 4


module my_module (a, b, c);

input a, b;

output c;

  assign c = a & b ;

endmodule

 

module top (a, b, c) ;

input [3:0] a, b;

output [3:0] c;

  my_module inst [3:0] (a, b, c);

endmodule 

[링크 : http://verilog.renerta.com/mobile/source/vrg00027.htm]


genvar k;

generate for (k = 1; k <`wordsize - 1; k = k + 1)

 begin

    I2S_dff instance (.d(sd), .q(q_out[i]), .r(wsp), .en(dec_out[i]), .sck(clk));

    datareg_in = |q_out;

 end

endgenerate 

[링크 : https://electronics.stackexchange.com/.../how-to-use-generate-for-multiple-module-instantiation-in-verilog]


From Verilog-95 you can have a vector of instances:

d_flipflop ff[7:0] (A, Q, reset clk); 

[링크 : https://stackoverflow.com/questions/21615210/instantiating-multiple-modules-in-verilog]

'Programming > Verilog' 카테고리의 다른 글

베릴로그 순차적 구조적  (2) 2018.01.18
structural vs behavioral verilog  (0) 2018.01.12
verilog always  (0) 2018.01.01
verilog 2001 ** 연산자  (0) 2018.01.01
verilog 코드 분석  (0) 2018.01.01
Posted by 구차니
Programming/C Win32 MFC2018. 1. 8. 11:29

eclipse에서 하려니 먼가 잘 안되고

(한줄에 여러개 있는게 되는게 있고 안되는게 있고 그러네..)

jindent 라는 플러그인 하니 라인길이 제한이 걸려있어서 유료 사야하고


notepad++에는

tidy 플러그인 깔아야 한다는데, 플러그인 매니저가 이상해져서 깔기 빡세고


웹에서 하는 것도 있지만

외부로 코드 유출되는거 아닌가 걱정되서 쓰기 그렇고..

그리고 파일단위가 아닌 복/붙해야 하니 귀찮...

[링크 : https://codebeautify.org/c-formatter-beautifier]


리눅스에서 툴을 이용하는것들 발견.. 해봐야 할 듯

[링크 : https://askubuntu.com/questions/448497/source-code-formatter-indenter]


clang-format 쓸만하긴 한데 하위 디렉토리 자동으로 뒤져서 하는건 없다고..

[링크 : https://stackoverflow.com/questions/28896909/how-to-call-clang-format-over-a-cpp-project-folder]

'Programming > C Win32 MFC' 카테고리의 다른 글

엔디안 급 멘붕..  (0) 2018.05.29
const char *과 char * const 차이  (0) 2018.01.31
win32 시리얼 통신 LPCTSTR / LPCSTR  (0) 2017.12.07
MFC CList 선택항목 인덱스 얻기  (0) 2017.11.28
MFC CSdlierCtrl 에서 SetPos()  (0) 2017.11.28
Posted by 구차니
Programming/Verilog2018. 1. 1. 09:51

always @ (posedge

이런식으로 많이 쓰이는데

always 자체는 패러럴 구문이지만 @와 결합해서 시퀀셜 하게 쓰이는 듯 하고,

@는 event에 대한 기술이다.


3. PARALLEL STATEMENTS 

always sequential_statement


5. SEQUENTIAL STATEMENTS

@ (event [{or event}]) sequential_statement

[링크 : http://www.ece.uvic.ca/~fayez/courses/ceng465/vlogref.pdf]


다만 =는 블럭킹(sequential, block) 으로

<=는 넌블러킹(parallel, non-blocking)으로 작동하게 되는데

[링크 : https://courses.cs.washington.edu/courses/cse467/03wi/Verilog3.pdf]

[링크 : https://class.ee.washington.edu/371/peckol/doc/Always@.pdf]


always 내에서 블럭킹으로 할 경우 race condition의 위험이 있다고 한다.

[링크 : https://www.nandland.com/vhdl/tutorials/tutorial-process-part1.html]

[링크 : http://aboutmadlife.blogspot.kr/2015/01/verilog-blocking-non-blocking.html]

'Programming > Verilog' 카테고리의 다른 글

베릴로그 순차적 구조적  (2) 2018.01.18
structural vs behavioral verilog  (0) 2018.01.12
verilog vector instance  (0) 2018.01.09
verilog 2001 ** 연산자  (0) 2018.01.01
verilog 코드 분석  (0) 2018.01.01
Posted by 구차니
Programming/Verilog2018. 1. 1. 09:37

VHDL 에서는 기본으로 있었던거 같은데

** 연산자는 지수승에 대한(밑이 2) 연산자로

Verilog 2001 부터 추가되었다고 한다.

지금에 와서는 거의 모든 개발 툴에서 2001을 지원하겠지?


[링크 : http://www.asic-world.com/verilog/verilog2k1.html]

'Programming > Verilog' 카테고리의 다른 글

베릴로그 순차적 구조적  (2) 2018.01.18
structural vs behavioral verilog  (0) 2018.01.12
verilog vector instance  (0) 2018.01.09
verilog always  (0) 2018.01.01
verilog 코드 분석  (0) 2018.01.01
Posted by 구차니
Programming/Verilog2018. 1. 1. 08:24

de0-nano 가속도 센서 예제 

예제가 죄다 verilog네 -_- VHDL을 공부하려는 나의 계획은 이렇게 날아 가는건가!!!


// -------------------------------------------------------------------- // 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: G Sensor utilization // // -------------------------------------------------------------------- // // Revision History : // -------------------------------------------------------------------- // Ver :| Author :| Mod. Date :| Changes Made: // V1.0 :| Rosaline Lin :| 02/16/2011 :| Initial Revision // -------------------------------------------------------------------- //======================================================= // This code is generated by Terasic System Builder //======================================================= module DE0_NANO_G_Sensor( //////////// CLOCK ////////// CLOCK_50, //////////// LED ////////// LED, //////////// KEY ////////// KEY, //////////// Accelerometer and EEPROM ////////// G_SENSOR_CS_N, G_SENSOR_INT, I2C_SCLK, I2C_SDAT ); //======================================================= // PARAMETER declarations //======================================================= //======================================================= // PORT declarations //======================================================= //////////// CLOCK ////////// input CLOCK_50; //////////// LED ////////// output [7:0] LED; //////////// KEY ////////// input [1:0] KEY; //////////// Accelerometer and EEPROM ////////// output G_SENSOR_CS_N; input G_SENSOR_INT; output I2C_SCLK; inout I2C_SDAT; //======================================================= // REG/WIRE declarations //======================================================= wire dly_rst; wire spi_clk, spi_clk_out; wire [15:0] data_x; //======================================================= // Structural coding //======================================================= // Reset reset_delay u_reset_delay ( .iRSTN(KEY[0]), .iCLK(CLOCK_50), .oRST(dly_rst)); // PLL spipll u_spipll ( .areset(dly_rst), .inclk0(CLOCK_50), .c0(spi_clk), // 2MHz .c1(spi_clk_out)); // 2MHz phase shift // Initial Setting and Data Read Back spi_ee_config u_spi_ee_config ( .iRSTN(!dly_rst), .iSPI_CLK(spi_clk), .iSPI_CLK_OUT(spi_clk_out), .iG_INT2(G_SENSOR_INT), .oDATA_L(data_x[7:0]), .oDATA_H(data_x[15:8]), .SPI_SDIO(I2C_SDAT), .oSPI_CSN(G_SENSOR_CS_N), .oSPI_CLK(I2C_SCLK)); // LED led_driver u_led_driver ( .iRSTN(!dly_rst), .iCLK(CLOCK_50), .iDIG(data_x[9:0]), .iG_INT2(G_SENSOR_INT), .oLED(LED));  

endmodule 

D:\de-nano\DE0-Nano_v.1.2.3_SystemCD\Demonstration\DE0_NANO_GSensor\DE0_NANO_G_Sensor.v

D:\de-nano\DE0-Nano_v.1.2.3_SystemCD\Demonstration\DE0_NANO_GSensor\v\led_driver.v


module module_name(module_in_outs);

// 일종의 입출력 변수들 정의(타입은 아직 정의하지 않고 이름만 정의


    // module의 핀(?)에 대한 입출력 방향과 타입을 정의

    input pin_name;

    output pin_name2;

    inout pin_name3;


    // 방향 지시자 없는 내부변수 선언

    wire pin_nam4;

    reg [1:0] count;


    // 행위를 정의함 - structural coding 라고 써있음

    assign out = in;


    // 조사필요

   always@(posedge iCLK or negedge iRSTN)

   submodule sub_module_name

   (

      .sub_module_pin(main_module_pin),

   );

// module의 끝

endmodule 


wire랑 reg도 변수 타입이고 그 외에는 int, real 등의 타입도 있다고..

[링크 : http://wiki.vctec.co.kr/devboard/fpga/spartan-3a-fpga-gaebalbodeu--elbert/module]

'Programming > Verilog' 카테고리의 다른 글

베릴로그 순차적 구조적  (2) 2018.01.18
structural vs behavioral verilog  (0) 2018.01.12
verilog vector instance  (0) 2018.01.09
verilog always  (0) 2018.01.01
verilog 2001 ** 연산자  (0) 2018.01.01
Posted by 구차니
Programming/VHDL2017. 12. 26. 15:14

VHDL

[링크 : http://jyhpan.tistory.com/141]

[링크 : https://blog.naver.com/r2adne/120155040778]

+

2017.12.27

[링크 : http://blog.naver.com/PostList.nhn?blogId=pcs874&from=postList&categoryNo=22]


verilog

FB-CY6-DEV, FM-CY6S


강좌 0. Verilog HDL 문법

강좌 1. 컴파일러 사용법 및 다운로드

강좌 2. 로직 시뮬레이터 사용법

강좌 3. 로직 설계 및 시뮬레이션

강좌 4. 계층구조 설계하기 (Byte Adder)

강좌 5. LED 켜기

강좌 6. 스위치 입력 받기

강좌 7. 7-Segment 사용하기

강좌 8. FSM 설계 (스탑와치)

강좌 9. 디지털 시계 설계하기

강좌 10. ADC 사용하기 (FSM 응용) 

[링크 : http://www.newtc.co.kr/dpshop/bbs/board.php?bo_table=m43&wr_id=3]

[링크 : http://vlsi.hongik.ac.kr/lecture/%EC%8B%A4%ED%97%98/Verilog_Summary.pdf]


+

2017.12.30

[링크 : http://www.asic-world.com/verilog/vqref1.html#Verilog_Quick_Reference]

[링크 : http://www.tcnj.edu/~hernande/r/VHDL_QRC__01.pdf] vhdl quick reference

+

2017.12.31

[링크 : http://www.ece.uvic.ca/~fayez/courses/ceng465/vlogref.pdf] verilog quick reference


+

2018.01.12

[링크 : https://blog.naver.com/culonion/80022938473]

[링크 : http://www.rebas.kr/category/Programming/Verilog]

[링크 : http://bokku.exblog.jp/11785594/]


+

2018.01.19

[링크 : https://www.nandland.com/verilog/tutorials/index.html] verilog

'Programming > VHDL' 카테고리의 다른 글

xilinx vivado HLx / HLS  (0) 2017.12.24
VHDL과 verilog  (0) 2017.12.11
VHDL 문법 공부중 1  (0) 2017.12.10
VHDL 문법 관련  (0) 2017.12.08
VHDL 문법  (0) 2017.12.07
Posted by 구차니
Programming/VHDL2017. 12. 24. 11:39

HLx는 실제로 FPGA를 위한 바이너리를 만들어 내는 녀석이고

(vhdl/verilog -> bitstream)

[링크 : https://www.xilinx.com/products/design-tools/vivado.htm]


HLS는 C언어로 작성한 녀석을 VHDL이나 Verilog로 변환해주는 (High Level Synthesis) 녀석이다.

(c -> vhdl/verilog)

[링크 : https://www.xilinx.com/products/design-tools/vivado/integration/esl-design.html]


일단은.. 궁금해서 예제 파일 아무거나 해서 막 눌러봤는데

신기하네.. 굳이 VHDL이나 Verilog 배워야 할 필요가 있을가? 싶은 HLS의 존재... ㄷㄷㄷ


HLS 예제에서 FFT/IFFT를 불러봤는데 C로 되어 있고 (UI가 암만봐도.. eclipse 다?)


합성 누르면 VHDL과


Verilog로 뱉어낸다. (verilog는 아직 문법을 안봐서...)


얘는 HLx 인데 예제 프로젝트 하나 생성해서 아무생각없이 그냥 빌드하니..

헐.. 먼가 멋지게 막 나온다. ㄷㄷ


확대 확대 확대~ 막 해도 계속 확대되서 무지 신기.. ㄷㄷ


회로 구조로 보는 것도 있는데.. 단계별로 같은 내용들이 보여서 무슨 차이인지 모르겠네..


Device에서 확대해보니..

LUT랑 Slice 라는 단어가 나오는데 정말 로직 레벨에서 해당 회로의 위치 까지 파악하도록

UI가 구성되어 있는 듯하다(도대체 얼마나 많은 개발자가 갈려나갔을까 ㄷㄷ)


'Programming > VHDL' 카테고리의 다른 글

vhdl / verilog 문법관련 링크  (0) 2017.12.26
VHDL과 verilog  (0) 2017.12.11
VHDL 문법 공부중 1  (0) 2017.12.10
VHDL 문법 관련  (0) 2017.12.08
VHDL 문법  (0) 2017.12.07
Posted by 구차니