embeded/FPGA - ALTERA2018. 6. 18. 15:06

modelsim에서 시뮬레이션 할 때

timescale의 값에 설정된 단위대로 돌게 되는데 일반적으로 1ns/10ps를 자주 쓴다.

앞에는 # 뒤에 오는 숫자의 단위 시간이고 

만약 timescale 10ns로 한다면 #1은 1ns대신 10ns로 설정되게 된다.


`timescale 1ns/100ps


module Counter_tb;


reg        clk;

reg        rst_n;

wire [7:0] cnt;

// 20 ns 이다..

parameter PERIOD = 20; 


Counter counter (

  .CLK(clk),

  .RST_N(rst_n),

  .CNT(cnt)

);


initial begin

  #0  clk   = 1'b0;

      rst_n = 1'b0;

  #10 rst_n = 1'b1;

end


// 50MHz 코멘트를 잘달자

always #(PERIOD/2) clk = ~clk;


endmodule 

[링크 : https://blog.naver.com/bohkyou/100093456018]


50MHz는 20ns 주기이고 high / low duty를 고려하면 50% 일 경우

10ns 의 high, 10ns의 low를 유지하면 된다.

그렇기에 timescale 1ns/10ps의 경우

#10 clk = 1;

#10 clk = 0;

으로 반복해서 수행하면 충분해야 할텐데..

의미로 간격 바꾸고 modelsim에서 돌리면 내가 의도한 것과 다르게 나오는 느낌..


조금더 공부를 해봐야 알 듯 하다 ㅠㅠ

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

dual purpose pins  (0) 2018.06.20
modelsim define clock  (0) 2018.06.19
modelsim nativelink  (0) 2018.06.18
modelsim 클럭연결하기  (0) 2018.06.15
intel FPGA를 이용한 Processor Logic 설계입문 관련 링크  (0) 2018.06.15
Posted by 구차니
embeded/FPGA - ALTERA2018. 6. 18. 10:30

카페 보다 보니 저걸 설정해서 하면 quartus 내에서 더 편하게 한다는데

기본 설정은 none으로 되어있다고 설정을 해야 한다고 한다.

[링크 : https://www.altera.com/.../modelsim/exm-ncsim-native-link.html]

[링크 : https://www.youtube.com/watch?v=PmVVXQchv2c]



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

modelsim define clock  (0) 2018.06.19
modelsim과 timescale 그리고 50Mhz  (0) 2018.06.18
modelsim 클럭연결하기  (0) 2018.06.15
intel FPGA를 이용한 Processor Logic 설계입문 관련 링크  (0) 2018.06.15
quartus 2 qar file  (0) 2018.06.11
Posted by 구차니
embeded/FPGA - ALTERA2018. 6. 15. 16:53

이런 저런 방법이 있는데 어떻게 쓰는건지 감이 1도 안오네..

[링크 : http://www.newtc.co.kr/download/FB-CY6/NTC_FPGA_강좌_02_로직_시뮬레이터_사용법.pdf]


waveform 어쩌구 통해서 시뮬레이션에 쓸 문장을 생성하는 듯?

[링크 : https://youtu.be/uSGsQjXWnXk?t=420]


waveform editor

[링크 : https://www.altera.co.jp/ja_JP/pdfs/literature/hb/qts/qts_qii53017.pdf]

어쩌다 먼가 된거 같긴한데 안된건가? ㅠㅠ


[링크 : http://www.ednc.com/wp/wp-content/uploads/2015/06/modelsim_questa_10.4_tutorial.pdf]


How do I generate clock in Verilog ?

There are many ways to generate clock in Verilog; you could use one of the following methods:


Method #1

 1 initial begin

 2  clk = 0;

 3 end

 4    

 5 always begin

 6    #5  clk = ~clk;

 7 

 8 end

You could download file clock_always.v here

 

Method #2

 1 initial begin

 2   clk = 0;

 3   forever begin

 4      #5  clk = ~clk;

 5   end

 6 end

You could download file clock_forever.v here


Method #3

 1 initial begin

 2   clk = 0;

 3 end

 4 

 5 always begin

 6    #5  clk = 0;

 7    #5  clk = 1;

 8 end 

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


+

2018.06.18

하다 보니.. 클럭 연결을 할게 아니라

# 명령중 반복을 통해서 특정 시간대에 클럭처럼 신호를 발생시키도록 해야

시뮬레이션에서 정상적으로 계산이 가능 한 듯?


음.. #5 하면.. 100Mhz로 작동하는건가?



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

modelsim과 timescale 그리고 50Mhz  (0) 2018.06.18
modelsim nativelink  (0) 2018.06.18
intel FPGA를 이용한 Processor Logic 설계입문 관련 링크  (0) 2018.06.15
quartus 2 qar file  (0) 2018.06.11
HDMI de0-nano  (0) 2018.06.05
Posted by 구차니
embeded/FPGA - ALTERA2018. 6. 15. 10:15

책에 사용한 소스 받는 곳 찾는 중


[링크 : http://digitalfilter.com]


Shift-JIS라 한글 윈도우에서 wordpad나 notepad로 열면 깨져서 안나온다 -_ㅜ

아무튼 저자가 암호 공개를 책 산 사람에게만 공개하고 있으니 저자의 뜻을 따르겠지만..

압축 - 압축 - 자동압축 파일 이런식으로 꽁꽁 싸매놓는건 무지 귀찮네...

FpgaOriginal.zipを展開するには,パスワードが必要です.


パスワードは,


 第1部 1日目 図1-23のタイトルにある8ケタの数字

 第2部 15日目 図15-15のタイトルにある5文字のアルファベット

 Appendix A 図A-4のタイトルにある7文字のアルファベット


以上をハイフンでつないだ文字列です.


例:12345678-YYYYY-ZZZZZZZ


すべて半角文字,アルファベットは大文字小文字に注意してください. 

[링크 : http://www.cqpub.co.jp/toragi/nios2/index.htm] << 100메가

[링크 : http://www.cqpub.co.jp/hanbai/books/48/48191.htm]

[링크 : http://www.cqpub.co.jp/toragi/nios2/movies/movie.htm]

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

modelsim nativelink  (0) 2018.06.18
modelsim 클럭연결하기  (0) 2018.06.15
quartus 2 qar file  (0) 2018.06.11
HDMI de0-nano  (0) 2018.06.05
de0-nano 그리고 modelsim 사용법  (0) 2018.06.04
Posted by 구차니
embeded/FPGA - ALTERA2018. 6. 11. 10:10

zip이나 tar는 아닌 독자 규격이거나 헤더를 변형한 녀석인 듯?

아무튼 프로젝트 열듯 더블 클릭해서 열면 해당 파일이 있던 곳에 압축이 풀리고

프로젝트 파일과 폴더가 풀려서 나온다.


Archiving Projects

You can save the elements of a project in a single, compressed Quartus II Archive File (. qar) by clicking

Project > Archive Project.

The .qar captures logic design, project, and settings files required to restore the project.

Use this technique to share projects between designers, or to transfer your project to a new version of the

Quartus II software, or to Altera support. You can optionally add compilation results, Qsys system files, and

third-party EDA tool files to the archive. If you restore the archive in a different version of the Quartus II

software, you must include the original .qdf in the archive to preserve original compilation results.

[링크 : https://www.altera.com.cn/zh_CN/pdfs/literature/hb/qts/qts_qii52012.pdf]

Posted by 구차니
embeded/FPGA - ALTERA2018. 6. 5. 10:55
Posted by 구차니
embeded/FPGA - ALTERA2018. 6. 4. 16:32

일단 하나 검색했으니 집에가서 따라해봐야지


RTL Level Simulation with ModelSim

- Synthesis 이후에 시뮬레이션 가능

Gate Level Simulation

- 전체 컴파일 이후에 시뮬레이션 가능

[링크 : http://idlelogiclabs.com/2011/12/04/using-modelsim-with-quartus-ii-and-the-de0-nano/]


게이트-레벨시뮬레이션은타이밍시뮬레이션에서 기능적결과의차이만을확인한다. 만약게이트-레벨시뮬레 이션은문제없고타이밍시뮬레이션이실패했다면, 넷리스트 가아닌타이밍으로발생된부분임을나타낸다. 백-어노테이트 타이밍 시뮬레이션은 타이밍 정보가 있는 게이트-레벨 시뮬레이션이다. 이를 위해 FPGA 벤더는 VITAL (VHDL Gate Level) 넷리스트 또는 Verilog 넷리스 트를 생성한다 

[링크 : http://www.itfind.or.kr/COMIN/file24639-FPGA%20디버깅%20방법.pdf]

Posted by 구차니
embeded/FPGA - ALTERA2018. 6. 3. 23:07

output 대신에

output reg를 쓰니 해결..

c언어 때 처럼 무슨 문제인지 감이 영안오네...


[링크 : https://electronics.stackexchange.com/...left-hand-side-of-assignment-must-have-a-variable-data-type]

Posted by 구차니
embeded/FPGA - ALTERA2018. 6. 2. 22:36

카운터 증가 하는데

클럭에 연계해서 작동시키는 부분에서

클럭 엣지 트리거 부분에 여러개 작성하니 에러 발생..


 always @ (posedge clk or negedge rst)

begin

if (~rst)

cnt <= 0;

else

begin

if(cnt < 834000)

cnt <= cnt + 1;

else

cnt <= 0;

end

if(cnt < HSYNC)

hsync <= 1;

else hsync <= 0;

if(cnt < VSYNC)

vsync <= 1;

else vsync <= 0;

end


아래는 해결 한 것

음.. 자세한 내용은 나중에 찾아봐야지.. 이해를 못하고 있음 ㅠㅠ

 always @ (posedge clk or negedge rst)

begin

if (~rst)

cnt <= 0;

else

begin

if(cnt < 834000)

begin

cnt <= cnt + 1;

if(cnt < HSYNC)

hsync <= 1;

else hsync <= 0;

if(cnt < VSYNC)

vsync <= 1;

else vsync <= 0;

end

else

cnt <= 0;

end

end


[링크 : https://www.edaboard.com/showthread.php?326768...-enclosing]

Posted by 구차니
embeded/FPGA - ALTERA2018. 5. 30. 15:14

DE0-nano에 실습중

일단.. module 선언이 아래 있던 위에있던 상관이 없나 보네..

머가 잘못되서 안되었던건지 모르겠지만 아무튼 책 보고 따라 치니 작동은 한다.


//=======================================================

//  This code is generated by Terasic System Builder

//=======================================================

module PwmCtrl(RST_N, CLK, LED0);

input RST_N, CLK;

output LED0;

reg[27:0] counter0;

always @(negedge RST_N or posedge CLK)

begin

if(RST_N == 1'b0)

begin

counter0 <= 0;

end else begin

counter0 <= counter0 + 1;

end

end

assign LED0 = counter0[26];

endmodule


module DE0_NANO(

//////////// CLOCK //////////

CLOCK_50,

//////////// LED //////////

LED,

//////////// KEY //////////

KEY 

);


//=======================================================

//  PARAMETER declarations

//=======================================================



//=======================================================

//  PORT declarations

//=======================================================


//////////// CLOCK //////////

input           CLOCK_50;

//////////// LED //////////

output      [7:0] LED;

//////////// KEY //////////

input      [1:0] KEY;


//=======================================================

//  REG/WIRE declarations

//=======================================================


//=======================================================

//  Structural coding

//=======================================================

PwmCtrl pwm(KEY[0],

CLOCK_50,

LED[0]);

endmodule 


원래는 counter0[27] 인데 너무 느려서 counter0[26]으로 변경


그리고 signalTap 이용해서 데이터 받아봄

(PLL 사용해서 클럭 분주하고 그걸 이용해 샘플링 주기를 변경해 봐야 할 듯)

2018/05/30 - [embeded/FPGA - ALTERA] - signal Tap 2와 talkback?

2018/05/24 - [embeded/FPGA - ALTERA] - altera signalTap <<

Posted by 구차니