⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3_08bcu

📁 大型risc处理器设计源代码,这是书中的代码 基于流水线的risc cpu设计
💻
📖 第 1 页 / 共 3 页
字号:
        ABP_DADE = 0;     // disable data output                                 g0256
      end                                                                        g0257
      else begin                                                                 g0258
        ABP_READ = 0;     // read no data                                        g0259
        ABP_DADE = 1;     // enable data output                                  g0260
      end                                                                        g0261
    end                                                                          g0262
  end                                                                            g0263
                                                                                 g0264
  //                                                                             g0265
  // Swap: switch from read to write                                             g0266
  //                                                                             g0267
  always @(posedge nMHS) begin                                                   g0268
    if (ABP_BUSY & nRESET & ~nRMW & RnW) begin                                   g0269
      ABP_READ = 0;    // finish read access                                     g0270
      ABP_RnW  = 0;    // set RnW to 0                                           g0271
    end                                                                          g0272
  end                                                                            g0273
                                                                                 g0274
  //                                                                             g0275
  // Finish memory access                                                        g0276
  //                                                                             g0277
  always @(posedge nMHS) begin                                                   g0278
    if (ABP_BUSY & nRESET & (nRMW | (~nRMW & ~RnW))) begin                       g0279
      ABP_ADDE = 0;    // disable address output                                 g0280
      ABP_BUSY = 0;    // note end of access                                     g0281
      ABP_DADE = 0;    // disable data output                                    g0282
      ABP_READ = 0;    // disable read access                                    g0283
      ABP_RnW  = 1;    // set RnW to quiescent state                             g0284
      ABP_nMRQ = 1;    // disable nMRQ                                           g0285
      ABP_nRMW = 1;    // set nRMW to quiescent state                            g0286
    end                                                                          g0287
  end                                                                            g0288
                                                                                 g0289
  //                                                                             g0290
  // Report abortion to memory                                                   g0291
  //                                                                             g0292
  always @(posedge CP) begin                                                     g0293
    if (ABP_BUSY & nRESET & BREAK_MEM_ACC) begin                                 g0294
      ABP_nMRQ = 1;    // disable nMRQ                                           g0295
    end                                                                          g0296
  end                                                                            g0297
                                                                                 g0298
  //------------------------------------------------------------------------     g0299
  //                                                                             g0300
  // Synchronous bus protocol                                                    g0301
  //                                                                             g0302
  //------------------------------------------------------------------------     g0303
                                                                                 g0304
  //                                                                             g0305
  // New memory access                                                           g0306
  //                                                                             g0307
  always @(posedge CP) begin                                                     g0308
    if (~SBP_SWAP & nRESET & nMHS & (DO_FETCH | ~BCU_ACC_MODE[2])) begin         g0309
      fork                                                                       g0310
        SBP_ADDE = #`DELTA 1;      // enable address output                      g0311
        SBP_RnW  = #`DELTA BCU_ACC_DIR[1] | ~BCU_ACC_DIR[0];  // set RnW         g0312
        SBP_nRMW = #`DELTA ~BCU_ACC_DIR[1];                   // set nRMW        g0313
        SBP_SWAP = #`DELTA  BCU_ACC_DIR[1];                   // SWAP flag       g0314
        SBP_nMRQ = #`BCUDELAY 0;   // output memory request to memory            g0315
      join                                                                       g0316
    end                                                                          g0317
  end                                                                            g0318
                                                                                 g0319
  //                                                                             g0320
  // Set nMRQ to 1 with falling clock                                            g0321
  //                                                                             g0322
  always @(negedge CP) begin                                                     g0323
    if (nRESET) begin                                                            g0324
      SBP_nMRQ = 1;  // set nMRQ to quiescent state                              g0325
    end                                                                          g0326
  end                                                                            g0327
                                                                                 g0328
  //                                                                             g0329
  // Memory access                                                               g0330
  //                                                                             g0331
  always @(CP or SBP_RnW or SBP_nMRQ or SBP_ADDE) begin                          g0332
    if (SBP_RnW & ~CP & SBP_ADDE) begin                                          g0333
      SBP_READ = 1;    // read data                                              g0334
    end                                                                          g0335
    else begin                                                                   g0336
      SBP_READ = 0;    // read no data                                           g0337
    end                                                                          g0338
    if (~SBP_RnW & SBP_nMRQ) begin                                               g0339
      SBP_DADE = 1;    // enable data output                                     g0340
    end                                                                          g0341
    else begin                                                                   g0342
      SBP_DADE = 0;    // disable data output                                    g0343
    end                                                                          g0344
  end                                                                            g0345
                                                                                 g0346
  //                                                                             g0347
  // Swap: switch from read to write                                             g0348
  //                                                                             g0349
  always @(posedge CP) begin                                                     g0350
    if (SBP_SWAP & nRESET & nMHS) begin                                          g0351
      fork                                                                       g0352
        SBP_SWAP = #`DELTA 0;    // clear SWAP flag                              g0353
        SBP_RnW  = #`DELTA 0;    // set RnW to write                             g0354
        SBP_nMRQ = #`DELTA 0;    // output new memory request                    g0355
      join                                                                       g0356
    end                                                                          g0357
  end                                                                            g0358
                                                                                 g0359
  //                                                                             g0360
  // Finish memory access                                                        g0361
  //                                                                             g0362
  always @(posedge CP) begin                                                     g0363
    if (~SBP_SWAP & nRESET & nMHS & ~(DO_FETCH | ~BCU_ACC_MODE[2])) begin        g0364
      fork                                                                       g0365
        SBP_ADDE = #`DELTA 0;    // disable address output                       g0366
        SBP_RnW  = #`DELTA 1;    // set RnW to quiescent state                   g0367
        SBP_nRMW = #`DELTA 1;    // set nRMW to quiescent state                  g0368
      join                                                                       g0369
    end                                                                          g0370
  end                                                                            g0371
                                                                                 g0372
  //                                                                             g0373
  // Report memory accesses in progress                                          g0374
  //                                                                             g0375
  always @(SBP_SWAP or SBP_nMRQ or nMHS) begin                                   g0376
    SBP_BUSY = SBP_SWAP | ~SBP_nMRQ | ~nMHS;   // show access activity           g0377
  end                                                                            g0378
                                                                                 g0379
endmodule // of bcu                                                              g0380

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -