untitled

Similar documents
untitled

移民資料

z x / +/- < >< >< >< >< > 3 b10x b10x 0~9,a~f,A~F, 0~9,a~f,A~F, x,x,z,z,?,_ x,x,z,z,?,_ h H 0~9,_ 0~9,_ d D 0~7,x,X,z,Z

untitled

untitled

untitled

微處理機實習期末專題

untitled

1

untitled

untitled

untitled

專 題 論 述

untitled

了 立 連 立 量 領 來 例 蘭 便 不 數 不 論 更 更 更 力 更 參 例 來 例 見 量 度 量 量 參 論 量 行 量 量 瑩 理 來 錄 量 量 不 力 省 力 立 力 量 量 量 了 量 便 錄 錄 錄 料 說 省 6

PowerPoint 簡報

第五章 實例個案

地方公共服務績效比較評量之探討—標竿學習策略的觀點

untitled

第五章 鄉鎮圖書館閱讀推廣活動之分析

untitled

人身保險業務員資格測驗方案

untitled

勞工安全衛生組織管理及自動檢查辦法修正條文對照表(草案)

廢證相關作業

STANDARD

untitled

untitled

untitled

untitled

untitled

untitled

個人教室 / 網路硬碟

untitled

untitled

untitled

untitled

untitled

廉 樂 不 廉 倫 理 廉 倫 理 領 不 參 領 不 若 不 不 不 不 利 聯 行 李 聯 例 律

龍華科技大學

四湖鄉志纂修

國立陽明大學輻射防護計畫書

untitled

untitled

I/O Files讀寫檔案:

自學進修學力鑑定考試職業證照與專科學校類科及筆試科目對照表

第三章 我國非營業特種基金制度及運作現況

untitled


公告99年度全民健康保險醫療給付費用總額及其分配

血管內裝置感染管制作業規範

untitled

說 列 流 不 不 理 料 理 路 數 錄 路 料 料 錄 路 列 來 料 便 利 行 狀 路 II

吃寒天真的能減肥嗎

untitled

untitled

untitled

94年度學習障礙補救教學進階研習

untitled

untitled

untitled

untitled

untitled

立 論 (93 年 5 ) 論 立 論 立 年 年 不 立 讀 理 念 不 數 列 論 錄 列 行 利 數 列 論 論 路 讀 利 索 列 論 陸 年 數 數 年 六 論 理 離 讀 利 索 列 列 論 理

untitled

國立政治大學新研所碩士在職專班

untitled

台灣經濟新報資料庫

臺灣地區的警察教育現況與展望

untitled

北 行 禮 北 路 樓 (02) 行 路 路 林 立 北 北 樓 便利 樓 車 車 行 15 聯 車 行 車

untitled

untitled

untitled

untitled

4-04 論文封面(樣式)

中華人民共和國殘疾人保障法(2008年修訂)

中華民國第45屆中小學科學展覽會

untitled

依據教育部八十九年 月 日臺(八九)技(二)字第 號函

1-2岁宝宝的游戏和活动指南

untitled

中臺科技大學學位論文典藏

untitled

2004/9/30

極限燙衣板

勞工安全衛生組織管理及自動檢查辦法修正條文對照表(草案)

untitled

untitled

WTO/TBT重要通知

untitled

untitled

九十三年度西醫基層醫療給付費用總額及其分配

untitled

untitled

untitled

untitled

untitled

untitled

九降風

Transcription:

Verilog HDL Verilog HDL 邏 令 列邏 路 例 練

數 度 (top-down design) 行 (concurrency)

2.1 Verilog HDL (module) 邏 HDL 理

HDL 邏 料 數 邏 邏 路 module module_name (port_list) // 列 <port_declarations> // <wire_register declaration> // <parameter_declarations> // 參數 <statements> // 邏 endmodule

料 例 module and (a, b, c) input a, b // output c assign c = a & b; // 邏 endmodule

2.1.1 ) ) 例 wire w1, w2 // wire [31 0] w3, w4 // 32 reg a // 1 reg [7 0] b,c // 8 (input) (output) (inout) [msb lsb] 若 ( 例 always )

2.1.2 讀 讀 料 讀 例 reg [10 0] counter // 11 reg a // 1 reg [2 0] b // 3 a = counter[9] //counter 9 a b = counter[5 3] //counter 5 3 b reg [10 0] table[0 31] //table 11 32 table[11] = 68 // 68 table 12

2.1.3 參數 例 module vadder (a, b, c) // 路 16 parameter wlen = 15 input [wlen 0] a, b output [wlen + 1 0] c assign c = a + b endmodule module tben1 // 路 vadder #(31) ad1(a1, b1, c1) // vadder #(63) ad2(a2, b2, c2) // endmodule

例 module tben2 vadder ad1(a1, b1, c1) vadder ad2(a2, b2, c2) defparam ad1.wlen = 31, ad2.wlen = 63 //ad1 ad2 更 32 64 endmodule

2.2 Verilog HDL 邏 Begin End 林 林 Default If Always Initial

2.2.1 (Module Instantiation) 兩 module_name instance_name(port1, port2, ); module_name instance_name(.mod_port1(inst_port1),.mod_port2(inst_port2), ); 例 module adder (a, b, c) // input a, b output c <expressions> endmodule module top (a1, a2, b1, c2) // adder input a1, a2, b1 output c2 wire c1 adder adder_1 (a1, b1, c1) // adder adder_2 (.a(a2),.c(c2),.b(c1)) // endmodule

例 moduledriver (out, in, en) output [2 0] out input [2 0] in input en buf u2 (out[2], in[2], en) buf u1 (out[1], in[1], en) buf u0 (out[0], in[0], en) endmodule moduledriver (out, in, en) output [2 0] out input [2 0] in input en buf u[2 0] (out, in, en) // u[2] u[1] u[0] endmodule

2.2.2 Verilog 邏 and nand or nor xor xnor buf tran not 2.2.3 令 (Operators in assignments) 降 列 1. (concatenation and replications) { } {{ }} 2. (unary)! ~ & ˆ 3. 數 (arithmetic) * / % 4. 數 (arithmetic) + - 5. (bitwise shift) << >> 6. (relational) > >= < <= 7. (equality) = = = = = = = = 8. 邏 (binary logical) &&!! 9. 邏 (binary bitwise) & ˆ ˆ 10. (conditional)

例 wire [15 0] new_word = {word[7 0],word[15 8]}; //byte 例 module add_32 (co, sum, a, b, ci) //32 output co output [31 0] sum input [31 0] a, b input ci assign {co, sum} = a + b + ci endmodule 例 initial begin byte = { 4 { 2 b01}} // 兩 01 01010101 word = {{ 8 { byte[7]}}, byte} // end

<LHS> = <condition> <if_expression> <else_expression> 例 // assign out = enable in bz 例 // wire [3 0] mux_out, in1, in2, in3, in4 wire [1 0] sel assign mux_out = (sel = = 2 b00) in1 (sel = = 2 b01) in2 (sel = = 2 b10) in3 (sel = = 2 b11) in4 4 bx

2.2.4 令 2.2.4.1 連 令 (Continuous assignments) assign 連 (procedural block) 邏 數 不 數

例 wire out assign out = a & b // 數 wire #10 inv = inv // 數 wire and_net = a1 & a2, or_net = a1 a2 // 兩 assign out[7 4] = in1[4 1] //

2.2.4.2 塞 塞 (Blocking and Non-blocking Assignments 塞 令 = 句 數 路 利 行 路 路 不 塞 令 <= 句 行 塞 令

例 // out 路 不 always @(posedge clk) out = outˆa1 always @(posedge clk) a1 = outˆin // 利 begin end 行 ok reg temp always @(posedge clk) temp = dout dout = tempˆa1 a1 = tempˆin end // 塞 令 <= always @(posedge clk) out <= outˆa1 always @(posedge clk) a1 <= outˆin begin

2.2.5 (Conditional Statements) 2.2.5.1 If and If-else

2.2.5.2 Case

2.2.6 (Procedural Blocks) 行 initial always 兩 begin end 列 行 錄 (activation list) (timing control, TC) 行

例 #n n 行 wait 數 立 行 @ 行 or posedge negedge

2.2.6.1 Initial initial 行 initial ( $display $gr_waves) 2.2.6.2 Always always 路 連 行 錄 (activation list) (reg)

2.3 令 (Compiler Directives)

2.4 列邏 路 2.4.1 狀 (Finite-State Machines)

2.4.2 狀 狀 (FSM State Transition Diagram )

2.4.3 狀 Verilog HDL

2.5 例 2.5.1 Moore Machine

2.5.2 Mealy Machine

2.6 練 1. Verilog HDL 立 I. 2-3 II. III. 2-4 D 立 D 2-5