2012年11月1日 星期四

使用者定義的原始值 User Defined Primitive (UDP)

源自於http://soc.eecs.yuntech.edu.tw/Course/Digital%20Logic%20Design/Verilog-Chap3.pdf


           使用者定義的原始值 

• 使用關鍵字 primitive 作宣告 
• 只可以有一個輸出且此輸出必須列在埠名 
   單的第一個還有必須用關鍵字output來宣告 。 
• 輸入數目不限制 ,至於它們在input宣告中的 
   順序則必須與它們在下面表中所給值的順 
   序相同 。

• 真值表必須在關鍵字table及endtable之間 。 
• 輸入值依順序列出 ,用冒號( :)代表結束 , 
   輸出通常是每一列的最後一個記錄 ,後面 
   跟著是一個分號( ;) 。 
• 最後用關鍵字endprimitive作結束 。 
   (利用一個真值表來定義UDP) 


//=========================
//Instantiate primitive 
module declare_crctp; 
     reg  x,y,z; 
     wire w; 
     crctp (w,x,y,z); 
endmodule 
//=========================

//User defined primitive(UDP) 
primitive  crctp (x,A,B,C); 
    output  x; 
    input A,B,C; 
//Truth table for x(A,B,C) = Minterms (0,2,4,6,7) 

    table 
//     A    B    C  :  x  (Note that this is only a comment) 
         0   0   0  :  1; 
         0   0   1  :  0; 
         0   1   0  :  1; 
         0   1   1  :  0; 
         1   0   0  :  1; 
         1   0   1  :  0; 
         1   1   0  :  1; 
         1   1   1  :  1; 
   endtable 
endprimitive 




沒有留言:

張貼留言

2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2

 2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2 AngularJS 實例 <!DOCTYPE html> <html> <head> &...