音影先锋亚洲天堂网|电影世界尽头的爱完整版播放|国产 熟女 91|高清无码免费观看欧美日韩|韩国一区二区三区黄色录像|美女亚洲加勒比在线|亚洲综合网 开心五月|7x成人在线入口|成人网站免费日韩毛片区|国产黄片?一级?二级?三级

登錄 免費(fèi)注冊(cè) 首頁(yè) | 行業(yè)黑名單 | 幫助
維庫(kù)電子市場(chǎng)網(wǎng)
技術(shù)交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術(shù) | 電源技術(shù) | 測(cè)控之家 | EMC技術(shù) | ARM技術(shù) | EDA技術(shù) | PCB技術(shù) | 嵌入式系統(tǒng)
驅(qū)動(dòng)編程 | 集成電路 | 器件替換 | 模擬技術(shù) | 新手園地 | 單 片 機(jī) | DSP技術(shù) | MCU技術(shù) | IC 設(shè)計(jì) | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe

請(qǐng)教高手關(guān)于verilog的問(wèn)題

作者:crni 欄目:EDA技術(shù)
請(qǐng)教高手關(guān)于verilog的問(wèn)題
請(qǐng)問(wèn)各位大蝦在verilog語(yǔ)言里,define和parameter有什么區(qū)別,比如:
parameter      REVISION_ID   =  8'h01;     

`define ADDR_512M   28'hE000_000
好象都是定義一個(gè)固定的常量呀,有什么區(qū)別呢?
小弟平時(shí)用VHDL,對(duì)verilog了解甚少,現(xiàn)在要讀一些用verilog寫(xiě)的代碼,這一點(diǎn)很是不明白,請(qǐng)各位指點(diǎn),多謝啦。。!




以下是完整的一段代碼
MODULE config_mux (pci_dat_out, ba0_size, ba1_size, bkend_dat,
                   pci_dat, pci_cbe_l, pci_addr, pci_rst_l,
           abort_sig, pci_clk, com, cbe_reg_l,
           idsel_reg, ba0_en, ba1_en, pci_irdy_l );
  OUTPUT [31:0] pci_dat_out; // the pci OUTPUT data bus
  OUTPUT [31:4] ba0_size; // The address space required for ba0
  OUTPUT [31:4] ba1_size; // The address space required for ba1
  OUTPUT [1:0] com; // The Mem - I/O enable bits of the command reg
  OUTPUT ba1_en, ba0_en;
  input pci_irdy_l;
  input [3:0] cbe_reg_l;
  input idsel_reg;
  input [31:0] bkend_dat; // BACK end data in
  input [7:0] pci_addr;
  input [31:0] pci_dat; // pci data
  input [3:0] pci_cbe_l; // byte enables in
  input pci_rst_l; // async reset
  input abort_sig; // state machine is aborting set status
  input pci_clk;  
reg [7:0] int_LINE; // r/w interupt LINE register
reg [31:0] pci_dat_out; // OUTPUT data bus
reg [31:0] cfg_dat_out; // OUTPUT data bus
reg [1:0] com; // The command register
reg stat11; // The status register bit for signaled target abort
reg stat_com_en;
reg int_LINE_en;
reg ba1_en;
reg ba0_en;
wire cfg_en;
reg cfg_out;
/******************************************************************/
// The following parameters set the values for the read ONLY
// configuration registers.
/******************************************************************/
/************    Start Reg 00h Section              ***************/
/******************************************************************/
// reg 00h (DevID/VendorID)
parameter    DEVICE_ID     = 16'h0120; // User Defined
parameter    VENDOR_ID     = 16'h1022; // Set to AMD
/******************************************************************/
/************    End Reg 00h Section              *****************/
/******************************************************************/
/******************************************************************/
/************    Start Reg 04h Section              ***************/
/******************************************************************/
//reg 04h (status/command)

// The ONLY bits used in this section are status[11:9]
// Command[1:0] The rest are all disabled to 0 at the Mux inputs

// `defines used for devsel
`define FAST    2'b00
`define medium  2'b01
`define slow    2'b10
parameter DEV_SEL = `slow; // medium devsel timing
// The creation of the status and Command Registers
always @ (posedge pci_clk or negedge pci_rst_l)
  if (pci_rst_l == 1'b0) begin
     com <= 2'b00; // disable I/O and MEM space accesses.
     stat11 <= 1'b0; // reset target abort status bit
  end
  else if (stat_com_en == 1'b1) begin
      if (!pci_cbe_l[0])  // check to see if byte lane is enabled
        com <= pci_dat[1:0];
      else
        com <= com;
      if (!pci_cbe_l[3] && pci_dat[27]) // check to see if byte lane is enabled
        stat11 <= 0; // write a 1 clears this bit
      else
        stat11 <= stat11;    
  end
  else if (abort_sig == 1'b1) begin
     stat11 <= 1'b1; // set target abort status bit
     com <= com;
  end
  else begin
    stat11 <= stat11;
    com <= com;
  end
/******************************************************************/
/************    End Reg 04h Section              *****************/
/******************************************************************/
/******************************************************************/
/************    Start Reg 08h Section              ***************/
/******************************************************************/
// reg 08h (Class/revision)
parameter    CLASS_CODE    = 24'h058000;    // MEMORY Controller
parameter    REVISION_ID   =  8'h01;        // Rev. 01
/******************************************************************/
/************    End Reg 08h Section              *****************/
/******************************************************************/
/******************************************************************/
/************    Start Reg 0Ch Section              ***************/
/******************************************************************/
// reg 0Ch (MISC Functions)
// No BIST, Type 00 HEADER, Ignore CacheLINEsize, No Latency Set,
parameter MISC_FUNCTIONS = 32'h00000000;
/******************************************************************/
/************    End Reg 0Ch Section              *****************/
/******************************************************************/
/******************************************************************/
/************  Start Base Address Defines Section   ***************/
/******************************************************************/
// Base address registers.
// The Following `defines are used in the Base Address Parameters
// To set if the BACK End DEVICE is:
//   -User I/O or MEMORY
//   -Where it is locatated in the address map
//   -If the BACKend DEVICE is prefetchable
//   -How much address space it requires
`define MEM_ON         1'b0
`define IO_ON          1'b1
`define ANYWHERE_IN_32 2'b00
`define BELOW_1M  &nbs
2樓: >>參與討論
吳明詩(shī)
不用貼這么一大堆
define和parameter的差別就好像是c的全局變量和局部變量的差別,define定義的整個(gè)文件都可以用,parameter的則是局部

3樓: >>參與討論
crni
哦,原來(lái)是這樣呀,多謝
 
4樓: >>參與討論
吳明詩(shī)
一般用parameter,當(dāng)然看具體情況了
 
參與討論
昵稱(chēng):
討論內(nèi)容:
 
 
相關(guān)帖子
跪求大蝦推薦關(guān)于ddr控制器方面的書(shū)或者資料!急用,謝謝
高手幫我分析下,我的秒表程序問(wèn)題出在哪
求指教
哪位大蝦有JTAG原理的中文版
小弟再求教大哥們兩個(gè)初級(jí)問(wèn)題!
免費(fèi)注冊(cè)為維庫(kù)電子開(kāi)發(fā)網(wǎng)會(huì)員,參與電子工程師社區(qū)討論,點(diǎn)此進(jìn)入


Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號(hào)