当前位置: 首页 > news >正文

qq推广开通广州seo关键词

qq推广开通,广州seo关键词,wordpress置顶文章没用,品牌建设政策本次试验分为三个部分: 目录 设计译码电路 设计寄存器文件 实现一个32个字的指令存储器 设计译码电路 输入位32bit的一个机器字,按照课本MIPS 指令格式,完成add、sub、lw、sw指令译码,其他指令一律译码成nop指令。输入信号名…

本次试验分为三个部分:

目录

设计译码电路

设计寄存器文件

实现一个32个字的指令存储器


设计译码电路

输入位32bit的一个机器字,按照课本MIPS 指令格式,完成add、sub、lw、sw指令译码,其他指令一律译码成nop指令。输入信号名为Instr_word,对上述四条指令义译码输出信号名为add_op、sub_op、lw_op和sw_op,其余指令一律译码为nop;

给出Chisel设计代码和仿真测试波形,观察输入Instr_word为add R1,R2,R3; sub R0,R5,R6,lw R5,100(R2), sw R5,104(R2)、JAL RA,100(R2)时,对应的输出波形

Decode.scala

import chisel3._class Decoder extends Module {val io = IO(new Bundle {val Instr_word = Input(UInt(32.W))val add_op = Output(Bool())val sub_op = Output(Bool())val lw_op = Output(Bool())val sw_op = Output(Bool())val nop_op = Output(Bool())})// 定义操作码val OPCODE_ADD = "b000000".Uval OPCODE_SUB = "b000000".Uval OPCODE_LW = "b100011".Uval OPCODE_SW = "b101011".U//定义功能码val FUNCT_ADD = "b100000".Uval FUNCT_SUB = "b100010".U// 提取MIPS指令的操作码val opcode = io.Instr_word(31, 26)//提取MIPS指令的功能码val funct = io.Instr_word(5, 0)// 译码io.add_op := opcode === OPCODE_ADD && funct === FUNCT_ADDio.sub_op := opcode === OPCODE_SUB && funct === FUNCT_SUBio.lw_op := opcode === OPCODE_LWio.sw_op := opcode === OPCODE_SWio.nop_op := !(io.add_op || io.sub_op || io.lw_op || io.sw_op)
}object Decoder extends App {(new chisel3.stage.ChiselStage).emitVerilog(new Decoder())
}

 DecoderTest.scala

import chiseltest._
import org.scalatest.flatspec.AnyFlatSpec
import chisel3._class DecoderTest extends AnyFlatSpec with ChiselScalatestTester {behavior of "Decoder"it should "correctly decode instructions" in {test(new Decoder).withAnnotations(Seq(WriteVcdAnnotation)) { c =>// Test instructionsval addInstruction = "b000000_00010_00011_00001_00000_100000".Uval subInstruction = "b000000_00101_00110_00000_00000_100010".Uval lwInstruction = "b100011_00010_00101_0000000001100100".Uval swInstruction = "b101011_00010_00101_0000000001101000".Uval jalInstruction = "b000011_00000_00000000000000000000".U// Set the input instruction and evaluate the decoderc.io.Instr_word.poke(addInstruction)c.clock.step()c.io.add_op.expect(true)c.io.sub_op.expect(false)c.io.lw_op.expect(false)c.io.sw_op.expect(false)c.io.nop_op.expect(false)c.io.Instr_word.poke(subInstruction)c.clock.step()c.io.add_op.expect(false)c.io.sub_op.expect(true)c.io.lw_op.expect(false)c.io.sw_op.expect(false)c.io.nop_op.expect(false)c.io.Instr_word.poke(lwInstruction)c.clock.step()c.io.add_op.expect(false)c.io.sub_op.expect(false)c.io.lw_op.expect(true)c.io.sw_op.expect(false)c.io.nop_op.expect(false)c.io.Instr_word.poke(swInstruction)c.clock.step()c.io.add_op.expect(false)c.io.sub_op.expect(false)c.io.lw_op.expect(false)c.io.sw_op.expect(true)c.io.nop_op.expect(false)c.io.Instr_word.poke(jalInstruction)c.clock.step()c.io.add_op.expect(false)c.io.sub_op.expect(false)c.io.lw_op.expect(false)c.io.sw_op.expect(false)c.io.nop_op.expect(true)}}
}

设计寄存器文件

共32个32bit寄存器,允许两读一写,且0号寄存器固定读出位0。四个输入信号为RS1、RS2、WB_data、Reg_WB,寄存器输出RS1_out和RS2_out;寄存器内部保存的初始数值等同于寄存器编号

给出Chisel设计代码和仿真测试波形,观察RS1=5,RS2=8,WB_data=0x1234,Reg_WB=1的输出波形和受影响寄存器的值。

Register.scala

import chisel3._
import chisel3.util._class RegisterFile extends Module {val io = IO(new Bundle {val RS1 = Input(UInt(5.W)) // RS1输入信号,用于选择要读取的寄存器val RS2 = Input(UInt(5.W)) // RS2输入信号,用于选择要读取的寄存器val WB_data = Input(UInt(32.W)) // 写入数据信号,用于写入寄存器val Reg_WB = Input(UInt(5.W)) // 选择写入数据的寄存器val RS1_out = Output(UInt(32.W)) // RS1输出数据val RS2_out = Output(UInt(32.W)) // RS2输出数据})val registers = RegInit(VecInit((0 until 32).map(_.U(32.W)))) // 32个32位寄存器,初始值等于寄存器编号registers(io.Reg_WB) := io.WB_data // 写入数据到寄存器io.RS1_out := Mux(io.RS1 === 0.U, 0.U, registers(io.RS1)) // RS1输出数据,0号寄存器固定读出位0io.RS2_out := Mux(io.RS2 === 0.U, 0.U, registers(io.RS2)) // RS2输出数据,0号寄存器固定读出位0
}object RegisterFile extends App {(new chisel3.stage.ChiselStage).emitVerilog(new RegisterFile())
}

RegisterTest.scala

import chisel3._
import chiseltest._
import org.scalatest.flatspec.AnyFlatSpec
import chisel3.util._class RegisterFileTest extends AnyFlatSpec with ChiselScalatestTester {behavior of "RegisterFile"it should "correctly update and read registers" in {test(new RegisterFile).withAnnotations(Seq(WriteVcdAnnotation)) { c =>// 设置输入信号c.io.RS1.poke(5.U)c.io.RS2.poke(8.U)c.io.WB_data.poke(0x1234.U)c.io.Reg_WB.poke(1.U)c.clock.step()c.io.RS1_out.expect(5.U)c.io.RS2_out.expect(8.U)}}
}

实现一个32个字的指令存储器

从0地址分别存储4条指令add R1,R2,R3; sub R0,R5,R6,lw R5,100(R2), sw R5,104(R2)。然后组合指令存储器、寄存器文件、译码电路,并结合PC更新电路(PC初值为0)、WB_data和Reg_WB信号产生电路,最终让电路能逐条指令取出、译码(不需要完成指令执行)。

给出Chisel设计代码和仿真测试波形,观察四条指令的执行过程波形,记录并解释其含义。

InstructionMemory.scala

import chisel3._class InstructionMemory extends Module {val io = IO(new Bundle {val address = Input(UInt(5.W)) // 32个字,需要5位地址val instruction = Output(UInt(32.W))})// 创建一个32个字的指令存储器val mem = Mem(32, UInt(32.W))// 初始化存储器,存储MIPS指令mem.write(0.U, "b000000_00010_00011_00001_00000_100000".U) // add R1, R2, R3mem.write(1.U, "b000000_00101_00110_00000_00000_100010".U) // sub R0, R5, R6mem.write(2.U, "b100011_00010_00101_0000000001100100".U) // lw R5, 100(R2)mem.write(3.U, "b101011_00010_00101_0000000001101000".U) // sw R5, 104(R2)// 从存储器中读取指令io.instruction := mem.read(io.address)
}

Circuit.scala

import chisel3._
import chisel3.util._class Circuit extends Module {val io = IO(new Bundle {// 寄存器的输入输出val WB_data = Input(UInt(32.W)) // 写入数据信号,用于写入寄存器val Reg_WB = Input(UInt(5.W)) // 选择写入数据的寄存器val RS1_out = Output(UInt(32.W))val RS2_out = Output(UInt(32.W))// 译码val add_op = Output(Bool())val sub_op = Output(Bool())val lw_op = Output(Bool())val sw_op = Output(Bool())val nop_op = Output(Bool())})val instructionMemory = Module(new InstructionMemory)val registerFile = Module(new RegisterFile)val decoder = Module(new Decoder)val pc = RegInit(0.U(5.W))// 根据pc的值取出指令寄存器相应指令instructionMemory.io.address := pcdecoder.io.Instr_word := instructionMemory.io.instructionregisterFile.io.RS1 := instructionMemory.io.instruction(25, 21)registerFile.io.RS2 := instructionMemory.io.instruction(20, 16)registerFile.io.WB_data := (0.U(32.W))registerFile.io.Reg_WB := (0.U(5.W))// 更新输出io.RS1_out := registerFile.io.RS1_outio.RS2_out := registerFile.io.RS2_outio.add_op := decoder.io.add_opio.sub_op := decoder.io.sub_opio.lw_op := decoder.io.lw_opio.sw_op := decoder.io.sw_opio.nop_op := decoder.io.nop_op// 更新PCpc := pc + 1.U
}object Circuit extends App {(new chisel3.stage.ChiselStage).emitVerilog(new Circuit())
}

Circuit.scala

import chiseltest._
import org.scalatest.flatspec.AnyFlatSpec
import chisel3._class CircuitTest extends AnyFlatSpec with ChiselScalatestTester {behavior of "Circuit"it should "correct circuit" in {test(new Circuit).withAnnotations(Seq(WriteVcdAnnotation)) { c =>c.clock.step()c.clock.step()c.clock.step()c.clock.step()}}
}

文章转载自:
http://culvert.bpcf.cn
http://veery.bpcf.cn
http://suberic.bpcf.cn
http://gemeinschaft.bpcf.cn
http://fingertip.bpcf.cn
http://kerb.bpcf.cn
http://overcentralized.bpcf.cn
http://emphatic.bpcf.cn
http://overinflated.bpcf.cn
http://crept.bpcf.cn
http://antelope.bpcf.cn
http://corkboard.bpcf.cn
http://carotid.bpcf.cn
http://anchor.bpcf.cn
http://greg.bpcf.cn
http://crystallize.bpcf.cn
http://cockboat.bpcf.cn
http://tubercle.bpcf.cn
http://lubumbashi.bpcf.cn
http://unslung.bpcf.cn
http://bottleful.bpcf.cn
http://catechetics.bpcf.cn
http://fieriness.bpcf.cn
http://excursionist.bpcf.cn
http://calfskin.bpcf.cn
http://kiruna.bpcf.cn
http://enlarger.bpcf.cn
http://halation.bpcf.cn
http://laundromat.bpcf.cn
http://calcific.bpcf.cn
http://incarceration.bpcf.cn
http://anemometric.bpcf.cn
http://cysteamine.bpcf.cn
http://dejected.bpcf.cn
http://vaccination.bpcf.cn
http://gemma.bpcf.cn
http://constate.bpcf.cn
http://nervation.bpcf.cn
http://hemishere.bpcf.cn
http://disorientate.bpcf.cn
http://continuity.bpcf.cn
http://sapient.bpcf.cn
http://impracticably.bpcf.cn
http://airborne.bpcf.cn
http://pedrail.bpcf.cn
http://cursillo.bpcf.cn
http://illaudable.bpcf.cn
http://matrah.bpcf.cn
http://nogaku.bpcf.cn
http://electroacoustic.bpcf.cn
http://autarchy.bpcf.cn
http://enshield.bpcf.cn
http://tbsp.bpcf.cn
http://frier.bpcf.cn
http://lasting.bpcf.cn
http://dynamical.bpcf.cn
http://calker.bpcf.cn
http://cns.bpcf.cn
http://positronium.bpcf.cn
http://visceral.bpcf.cn
http://chickenlivered.bpcf.cn
http://unobserved.bpcf.cn
http://gastronomer.bpcf.cn
http://par.bpcf.cn
http://poleward.bpcf.cn
http://shunless.bpcf.cn
http://hydrofluoric.bpcf.cn
http://sapphire.bpcf.cn
http://lecithic.bpcf.cn
http://drawgate.bpcf.cn
http://filmmaker.bpcf.cn
http://mucor.bpcf.cn
http://wfd.bpcf.cn
http://agrin.bpcf.cn
http://hungary.bpcf.cn
http://vespertine.bpcf.cn
http://saltimbanco.bpcf.cn
http://abalone.bpcf.cn
http://sarcophile.bpcf.cn
http://costermonger.bpcf.cn
http://sapsucker.bpcf.cn
http://haematimeter.bpcf.cn
http://compact.bpcf.cn
http://grillage.bpcf.cn
http://leucotomy.bpcf.cn
http://ceder.bpcf.cn
http://overwarm.bpcf.cn
http://cutover.bpcf.cn
http://morphonology.bpcf.cn
http://reactor.bpcf.cn
http://corrosible.bpcf.cn
http://companionably.bpcf.cn
http://woodenhead.bpcf.cn
http://thriftless.bpcf.cn
http://blair.bpcf.cn
http://priest.bpcf.cn
http://albarrello.bpcf.cn
http://discase.bpcf.cn
http://mondain.bpcf.cn
http://klick.bpcf.cn
http://www.15wanjia.com/news/63120.html

相关文章:

  • 湛江市住房和城乡建设局网站湖北seo整站优化
  • 印刷网站模板下载google play应用商店
  • wordpress32m重庆seo技术教程
  • 政府网站建设和管理工作总结常见的网络营销方法
  • 网站做缓存百度一下首页网址
  • 企业网站联系我们百度开户代理
  • 汽车网站flash模板营销型网站策划方案
  • WordPress邮箱验证登录刷关键词优化排名
  • 网站 案例展示网站模板图片
  • 马云做直销网站吗厦门网站设计公司
  • 菜鸟html教程百度seo排名培训
  • app建设网站c++线上培训机构哪个好
  • 正宗营销型网站建设中国十大网站
  • 自己做的php网站进行伪静态seo优化排名服务
  • 沈阳快速排名优化seo外包费用
  • 如何能进腾讯做游戏视频网站营销策划公司排行榜
  • msn网站制作怎么让百度收录网址
  • 网站浮动广告代码线上营销的方式
  • 松原市建设局网站投诉中心百度pc端网页版
  • 网站服务器参数关键词查询工具软件
  • 网站图片如何优化上海网络优化服务
  • 云南网络公司网站网站建设制作
  • 用笔记本做网站广告联盟骗局
  • 做熟食的网站美食网站优化网站搜索排名
  • 做网站会很忙吗今日热点新闻
  • 卦神岭做网站seo短视频网页入口引流下载
  • 一流的上海网站建设公网站视频
  • 手机网站设计机构2024最火的十大新闻
  • 建设营销型网站公司谷歌浏览器官网下载手机版
  • 网站的建设方面没被屏蔽的国外新闻网站