码农知识堂 - 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
      在这里插入图片描述
  • 相关阅读:
    【670. 最大交换】
    2023年全球及中国层析系统市场发展趋势分析:未来层析设备市场将持续增长[图]
    [Python人工智能] 三十六.基于Transformer的商品评论情感分析 (2)keras构建多头自注意力(Transformer)模型
    汽车厂商查询易语言代码
    「小邓观点」SIEM解决方案的数据聚合组件
    C++从入门到精通 第十四章(STL容器)【上】
    VScode如何调节编辑器字体大小
    文件名翻译,轻松批量转换,让你的文件名更具国际化
    Redis 提示“Couldn‘t determine DBSIZE!”
    C++ RBTree 理论
  • 原文地址:https://blog.csdn.net/weixin_39280437/article/details/125627666
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号