码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Introduction to Assembly and RISC-V


    文章目录

      • 1. "General Purpose" Processors
      • 2. Components of a Microprocessor
      • 3. Assembly Language Program
      • 4. Program to sum array elements
      • 5. Instruction Set Architecture(ISA)
      • 6. RISC-V Processor Storage
      • 7. Instructions
        • register-register instructions
        • register-immediate instructions

    1. “General Purpose” Processors

    在这里插入图片描述
    It would be highly desirable if the same hardware could execute program written in Python,Java,C or any high-level language.
    It is also not sensible to execute every feature of a high-level language directly in hardware

    2. Components of a Microprocessor

    1. Each register is of fixed size,say 32 bits
    2. The number of registers are small,say 32
    3. ALU directly perform operations on the register file,typically ·x_i <- Op(x_j,x_k) where Op∈{+,AND,OR,<,>,…}
    4. Memory is large,say Giga bytes,and hold program and data
    5. Data can be moved back and forth between Memory and Register File using load and store instructions
      在这里插入图片描述

    3. Assembly Language Program

    An assembly Language Program is a sequence of instructions which execute in a sequential order unless a control instruction is to be executed.
    Each instruction specifies a operation supported by the processor hardware

    1. ALU
    2. Load and Store
    3. Control Transfer:e.g. if x_i < x_j go to label l

    4. Program to sum array elements

    sum = a[0] + a[1] + a[2] + … + a[n-1]
    在这里插入图片描述

    x1 <- load(base) 	//load data from main memory to register x1
    x2 <- load(n)    //load data from main memory to register x2
    x3 <- 0                 //let register x3 = 0
    loop:                   //sign for repeating
    x4 <- load(Mem[x1])     //load data from main Mem[x1] to register x4
    add x3, x3, x4          //ALU arithmetic:data of x3 plus data of x4 and assign the sum to regeister x3
    addi x1, x1, 4          //ALU arithmetic:data of x1 plus 4 and assign the sum to regeister x1
    addi x2, x2, -1         //ALU arithmetic:data of x2 plus -1 and assign the sum to regeister x2
    //bnez(Branch if Not Equal to Zero)
    bnez x2, loop           //if data(x2) != 0,retuen to the foregoing loop and excute again
    store(sum) <- x3        //store data form register x3 to main Memory sum
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    在这里插入图片描述

    5. Instruction Set Architecture(ISA)

    • ISA:The contract between software and hardware
      • Functional definition of operations and storage locations
      • Precise description of how software can invoke and access them
    • RISC-V ISA:
      • A new,open,free ISA from berkeley
        在这里插入图片描述

    6. RISC-V Processor Storage

    在这里插入图片描述

    7. Instructions

    Three Types of operations:

    • Computational
    • Loads and Stores
    • Control Flow

    register-register instructions

    • 2 source operand registers
    • 1 destination register
    • format: oper dest,src1,src2

    register-immediate instructions

    • 1 source operand register
    • a small constant that is encoded into the instruction
    • format:oper dest,src1,const
      在这里插入图片描述
  • 相关阅读:
    python 实现等声值线图绘制
    52_数据结构
    linux内存分配器
    华为云云耀云服务器L实例评测|Elasticsearch的可视化Kibana工具安装 & IK分词器的安装和使用
    架构道术-企业选择Dubbo作为分布式服务框架的10个理由
    如何使用chatGPT写好Prompt提示词: Few-shots
    再回首 Java核心技术 2 —— Java数据类型
    踩坑ImageMagick将ios图片文件HEIC格式转jpg/png等
    web中缓存的几种方式
    22年PMP考试内容大改,敏捷项目管理全套资料,不看过不了!
  • 原文地址:https://blog.csdn.net/weixin_39280437/article/details/125627666
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号