CEG 2136 Arithmetic Logic Unit

SpringBoot+Vue+MySQL 高校学科竞赛平台 完整可运行版(源码+文档) 本项目基于SpringBoot+Vue+MySQL构建高校学科竞赛管理平台,覆盖学生、教师、领队教师、管理员四大角色,实现竞赛发布、报名、刷题、评分、公示等全流程闭环管理。系统架构清晰,技术主流,配套完整源码、数据库脚本、万字论文、开题报告、答辩PPT及部署文档,支持一键运行,适用于毕业设计、课程设计及院系二次开发,真正实现“开箱即用”。 阅读详情

CEG 2136 Lab 3

LAB 3 Arithmetic Logic Unit

1.   Purpose:

In this lab students will design, simulate, build and test an Arithmetic Logic Unit (ALU),  employing Quartus II as a development environment and the Altera DE2-115 board as  experimental platform. ALU has to execute 16 different operations on two operands of 4  bits and will provide a 4-bit result along with 4 status bits (oVerflow, Zero, Negative,  Carry). The input operands will be generated by slide switches (or by “input_generator” component if you are testing your design remotely), while the result and the status bits will  be displayed on LEDs.

2.   Requirements of the Lab:

The following will be submitted in your report.

* Functional and truth tables, equations and schematics of your design

* Log of what you did

* Screen shots of all schematics and waveform. diagrams

* Compilation, simulation and downloading messages (if any)

* Test results

3.   Equipment and Supplies:

* Quartus II (student edition or web edition)

* Altera DE2-115 board with USB-Blaster cable and Power supply 12 VDC, 2A

4.   References:

4.1. Chapter1 - 4 of the Textbook: Computer System Architecture, Morris Mano, 3rd Ed.

4.2.  Course notes and

4.3. DE2-115 User Manual posted  in  the Documentation section  under  the Laboratories tab of CEG2136 Virtual Campus.

5. PreLab - Design of the ALU

5.1. ALU structure

The Central Processing Unit (CPU) consists of a Control Unit (CU) and a Datapath (execution unit – EU) as shown in the block diagram of Figure 1.

The CPU’s datapath contains registers to store data (A, B, C) and control (S) / status (V,Z,N,Cy) information, along an Arithmetic and Logic Unit (ALU). You have to design CPU’s datapath that can perform. arithmetic, shift and logic operations. Your datapath module will handle two types of signals:

Data (inputs: A3-A0 and B3-B0, and outputs C3-C0) – marked in yellow

Control (operations codes) / status: S3-S0 / (V, Z, N, Cy) – marked in light blue in Fig. 1

Figure 2(a) presents the ALU datapath. For testing purposes, since CU (the light-blue block in Figure 2) is not designed and built in this lab, CU is replaced and emulated by 4 DIP switches for generating the ALU control inputs (S3 - S0) and 4 LEDs to display the ALU’s state indicators (V,Z,S,O). Operands A and B are generated manually by 8 DIP switches, while the result C is displayed by other 4 LEDs.

Note: This term we will not use DIP switches to generate the test inputs (A, B) and control signals (S) for experimental verification of your ALU. Instead, we are going to use a pre-designed component named “input_ generator” which generates sequences of test vectors A, B, S. Figure 2(b) shows the block diagram of the datapath that we will use for this purpose.

ALU is a combinational circuit which can execute any of the 16 micro-operations of Table 1. The operation to be performed is set by the control word (operation code) S3-S0 as explained below:

the control signal S3 selects either the Arithmetic Circuit (AC) or the Logic and Shifting Circuit (LSC) to perform. the operation and send the result to the output C;

the control signals S2, S1, and S0 define the operations to be performed by each circuit (AC or LSC).

Both inputs and outputs are stored in buffer registers (D flip-flops synchronized with the same clock), A, B, and C, as shown in Figure 2. To operate at the highest speed, the ALU datapath should be provided with both operands (Aand B) and control bits (S3-S0) at every consecutive clock. To insure a correct operation of the datapath, the total delay introduced by the ALU’s circuits should be smaller than the clock’s period and, as such, the datapath can execute a micro-operation at every clock. The results (C3-C0) and V, Z, S, Cy are provided on the next pulse following the change of A, B and S.

5.2. Hierarchical design

Since both the input and the output signals of ALU have 4 bits, the most effective way to implement ALU is to devise it in a hierarchical manner. Files on the lowest level are 1-bit full adder and 1-bit logic and shift circuit (LSC). The intermediate files will consist of a 4- bit register, a 4-bit arithmetic circuit (AC), a 4-bit logic and shift circuit (LSC), and a state circuit. Finally, the file at the highest level will cover the complete circuit, loadable to the Altera DE2-115 board. The relation between these files is shown in figure 3. The parts in yellow will be explained further in this document. For the preparation of this lab, you are required to design and test the circuits coloured in green,i.e., the 1-bit LSC, the 4-bit LSC, the 4-bit AC, and the state circuit.

5.3. Design of Logic and Shift Circuit (LSC)

LSC operates at the bit level, which means that, e.g. C = A AND B is interpreted as {C3, C2, C1, C0} = {A3 AND B3, A2 AND B2, A1 AND B1, A0 AND B0}.

Design a circuit which implements all logic and shift functions as shown in the bottom half of Table 1 (with S3=1). LSC is built from four 1-bit Logic and Shift Circuit (LSC).   Such a 1-bit module has 3 control inputs (S2, S1, and S0), two logic inputs (Ai and Bi), two additional inputs for left and right shifts (Ai-1 and Ai+1), and an output (CL i) whose truth table is detailed below. A starting point for the logic diagram of 1-bit LSC is suggested below;

5.3.1. Add all the logic gates that are required to complete the LSCi logic diagram of Fig. 4.

5.3.2.   Use the 1-bit LSC module that you designed above to build a 4-bit logic and shift circuit LSC. Your final design should have 3 control inputs (S2 - S0), 8 data inputs (A3 - A0 and B3 - B0), and 4 data outputs (CL3 - CL0). Your design will be captured in the logiccircuit4bit file.

5.4. Design of Arithmetic Circuit (AC)

5.4.1.   The block diagram of the Arithmetic Circuit (AC) is shown in Fig. 5. AC consists of a 4-bit full adder (∑) which calculates the output CA as a function of operands op1 and op0, and of the micro-operation select bits S2, S1 and S0, as described in Table 1.

Complete the following truth table with the corresponding values derived from Table 1.

5.4.2.  Note that the data inputs A3 - A0 and B3 - B0 should not be connected directly to the inputs of multiplexers for op1 and op2, since you might need some minimal logic to insure full compliance with the truth table. A trivial solution is to implement op1 and op0 with 8-to-1 multiplexers. Start your design by analyzing what inputs are to be brought to op1 and op0 for each combination of S2 and S1, only.

Derive a cost effective solution from this analysis using a 4-to-1 multiplexer.

5.4.3. Derive the equation of Cy_in in terms of the select bits S2, S1 and S0.

5.4.4. Complete the block diagram of ACi of Fig. 6 with logic components that implement the conclusions you drew above (5.4.1 - 5.4.2):

●  replace the multiplexor symbols with the ones resulted at 5.4.2;

●  add more wires and other logic components between module’s inputs (Ai, Bi , S2, S1 and S0) and multiplexers’ inputs to implement the AC table;

●  implement Cy equation.

This ACi schematic will be later captured in the fulladder1bit.bdf file in Quartus II. Note: ∑i is based on the full adder shown in Figure 9.

The ALU Data Output is provided by AC or LSC as dictated by the control signal S3. The block diagram of Fig. 7 employs 2-to-1 multiplexers to select AC or LSC to be loaded into register C.

Your final circuit of the ALU data flow should have 3 control inputs (S2 - S0), 8 data inputs (A3 - A0 and B3 - B0), 4 data outputs (C3 - C0) and the most significant carry bits,which will be used for the status circuit.

5.5. ALU status register

The ALU results are characterized by four status bits (C, S, Z, and V), which are defined as follows:

Bit Cy (carry) is set to 1 only when the operation is an arithmetic operation and its carry output is 1. It is cleared to 0 if the carry is 0.

Bit S (sign) is set to 1 if the most significant bit of the result C3 is one.

Bit Z (zero) is set to 1 only if the output of the ALU contains all 0’s. It is set to 0 otherwise.

Bit V  (overflow)  is  set  to  1  only  when  an  overflow  occurs  when  performing operations on signed numbers in 2’s complement representation.

Derive the logic equations of the status bits and implement them with conventional gates.

std::map看来可以被淘汰了?可以用vector来替代,而且更好 vector的优势在于内存连续,可以先std::sort,然后std::lower_bound,或者std::binary_search。而std::map,insert的时候,需要new出内存。 阅读详情

相关推荐

vcenter server6.0上vmware inventory 、virtualvcenter等服务无法开启

描述:一天,vcenter访问不了,因此Windows远程到vcenter server上。相关服务未开启,开启virtualCenter server服务提示相关依赖服务未开启,于是开启依赖项服务Inventory服务报错。然后打算使用 C:\Program Files\VMware\vCenter Server\bin\servcivce-control来开启vmware服务 1....

Pespi_Co1a的博客 3072

CEG 2136 LAB 3 Arithmetic Logic Unit

LAB 34.3.DE2-115UserManualpus.ALUstructurecontrolwordoperationcodebitfulladderand 1-bitlogicandshiftcircuit, a 4-(AC), a 4-Circuit(LSC)AiandBiAi-1andAi+1CLi1-bitof Fig. 4.build aitfile.5.4.

biliminy的博客 721

基于Active-HDL的HDL设计录入与仿真

作者:毛茏玮 / Saint 掘金:https://juejin.im/user/5aa1f89b6fb9a028bb18966a 微博:https://weibo.com/5458277467/profile?topnav=1&wvr=6&is_all=1 GitHub:github.com/saint-000 优快云: https://me.youkuaiyun.com/qq_4053...

一个会写代码的烤鸭 7785

177.Agent-LangGraph-MCP的构成说明

MCP架构通过MCP主机、客户端与服务器的协同,实现工具、资源与提示词的统一管理。MCP服务器提供Tools、Resources、Prompts能力,MCP客户端则负责发现、调用与读取,使Agent可按需获取上下文。其核心在于将工具从Agent中抽离,封装为可复用的服务,提升灵活性与可维护性,推动AI应用高效协作。

计算机王的博客 315

win11本地部署openclaw实操第1集

OpenClaw 是一款开源、本地优先、可自托管的 AI 智能体(AI Agent)网关 / 自动化框架,核心是让 AI 从 “只聊天、给建议” 变成 “能在你电脑上真做事” 的数字助手。

weixin_44626085的博客 7131

用Python手把手教你实现一个多层感知机(MLP)——从理论到代码实战

本文详细介绍了如何使用Python和Theano库从零开始实现多层感知机(MLP),涵盖从核心原理到代码实战的全过程。通过构建隐藏层、输出层和完整MLP模型,结合权重初始化、激活函数选择和训练技巧,帮助开发者深入理解神经网络工作机制,并应用于实际机器学习任务。

web39explorer的博客 971

Docker Compose:搭建本地多服务开发环境

从一个 Java API、PostgreSQL 和 Redis 开始,配置服务名、端口、环境变量、健康检查、数据卷和依赖关系。理解 Compose 文件如何被解析、项目如何隔离,以及哪些数据不能依赖“重建容器”保留,能够把个人开发环境整理成团队可复用的启动入口。

m0_62221377的博客 478

Rancher入门到精通 - Nginx Ingress 配置指南

Rancher 是一个开源的容器管理平台,它提供了一套完整且易于使用的工具来部署、管理和扩展容器化应用。而 Nginx Ingress 则是一个常用的开源 Ingress 控制器,用于将外部请求流量导入到 Kubernetes 集群中的服务。在开始之前,请确保您已经正确安装了 Rancher 平台和 Nginx Ingress 控制器。

TechInk的博客 1312

AI全栈实战 | 3.9-01 爬虫入门:requests 加 BeautifulSoup 三分钟跑通,但 90% 的人栽在这 4 个“礼貌“问题上

⚠️:本文内容仅用于。请遵守目标站点的服务条款与相关法律法规,不得对目标服务造成负担,不得采集、传播个人隐私数据。技术是中性的,边界在你手里。爬虫的入门技术(requests 发请求 + BeautifulSoup 解析)三分钟就能学会。真正区分"会用爬虫"和"会做爬虫的人"的,是这篇我们跑通"请求→解析→存储"的最小闭环,然后重点把"合规与礼貌"这根弦给你绷上。

源码获取 | 运行部署 | 定制二开修改,如果回复不及时请耐心等待,请见谅。 441

vue3 - 详细实现视频/图片/图文“响应式瀑布流“列表布局示例代码,手机移动端H5或PC端电脑网页根据屏幕宽度自适应响应式瀑布流效果,支持数据列表动态懒加载,仿小红书图文视频div容器的瀑布流方案

vue3,nuxt3,瀑布流,响应式,图片瀑布流,视频瀑布流,图文瀑布流,手机移动端,H5瀑布流,电脑PC网站,手机电脑都能用的瀑布流布局,屏幕自适应,最好用的瀑布流组件插件,滚动分页加载瀑布流列表,瀑布流效果,自适应瀑布流布局详细教程,动态加载数据,懒加载,小红书,图文列表,视频列表,列表容器高度不一致怎么排列,整个屏幕全是宽高不固定的div容器列表怎么办,移动端和pc端双端实现瀑布流,vue3实现图片瀑布流布局以及响应式,滚动条触底懒加载,组件插件,vue3瀑布流 电脑手机都能用,解决卡顿不流畅,对不齐

✅ 精选推荐文章 4341

《Autosar_MCAL高阶配置》总目录_培训教程持续更新中...

《Autosar_MCAL高阶配置》总目录_培训教程持续更新中...

「汽车电子助手」的博客 1万+

spring boot 4集成SQLLite,及其SQLLite的建库

spring boot 4集成SQLLite,及其SQLLite的建库

weixin_41463944的博客 231

YOLO26优化:AAAI2026 | 融合PartialNet Block的C3k2-YOLO高效目标检测网络 | 轻量化涨点设计

PartialNet Block 结合YOLO26的C3k2模块,进行二次创新。

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 597

【基于 WebSocket 的多用户网页五子棋】—— 数据管理模块

但行好事,莫问前程

qq_42996461的博客 259

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

OpenClaw 深度调查:把 AI 助手做成你自己的控制平面

对 openclaw/openclaw 的完整技术尽调:Gateway 架构、Agent 运行时、工具与沙箱、30 个消息通道、181 个插件、安全信任边界、工程代价与采用建议。17 章 / 10 张图,全部数字标注口径,数据截至 2026-10-31。

厚积薄发 349

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

IDEA 简介:从零认识 IntelliJ IDEA

IDEA 全称,是由 JetBrains 公司开发的一款主流 Java 集成开发环境(IDE)。它集代码编辑、编译、调试、测试、版本控制、构建管理等功能于一体,被大量 Java 开发者视为日常开发的首选工具。所谓 IDE(Integrated Development Environment,集成开发环境),就是把写代码所需的各类工具整合到同一个界面中。相比只用文本编辑器加命令行编译,IDE 能显著减少重复操作,让开发者把精力集中在业务逻辑上。

ztI10的博客 184

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

TransactionInactiveError:await 之后事务已经不活跃了

TransactionInactiveError 出现于 IndexedDB 事务已结束(非 active 状态)时调用 put、get 等操作。常见于 await 后或 setTimeout 中执行请求,因任务已完成,事务已提交或进入 finished 状态。请求必须在创建事务的同一任务中挂起,否则无效。解决方法:在 onsuccess 回调内同步发起后续操作,或提前将所有请求挂入事务。避免在异步上下文中使用事务操作,确保请求在事务活跃期内完成。

qq_40822000的博客 159

Docker部署linkding:HTTPS与数据备份

部署私人书签库,除了让页面能够打开,还需要考虑几个实际问题:重建容器后数据是否保留、登录和保存是否正常、升级前怎样备份,以及出现 502 或 CSRF 错误时从哪里检查。本文使用 Docker Compose 部署 linkding,采用默认 SQLite 数据库,通过 Caddy 提供 HTTPS,并完成账户创建、数据持久化验证和备份。如果重建后账户或书签消失,应先检查是否换了项目目录、改了挂载路径,或者启动了另一套实例,不要急着重新初始化。遇到权限问题,应根据日志确认具体目录和运行用户,再调整权限。

tedcloud123的博客 193

云计算课程小组PPT汇报任务书

36人分为6组,每组6人;形式:生活案例调研 + 理论解读;汇报时长7‑9min;PPT建议10‑14页。

Michelle8023的博客 226

企业官网源码与数据资产交接:四项权利、五组自动检查

企业官网源码交接不仅要看压缩包,还要核域名、云资源、构建脚本、数据库恢复、权限与密钥。

sweetofmine1的博客 186

软件项目交付时,源代码之外还应该交付哪些技术资料?

软件项目交付时,除可运行程序外,还应核对源代码、数据库结构、接口文档、部署运维、测试验收和账号资产。本文从实际交付环节拆解完整资料清单,并说明合同如何约定交付范围、知识产权与维护边界。

chengduyoushu的博客 308

Java 项目实战:交友项目后台系统——网关统一鉴权与 B 端管理后台

本次改造通过引入SpringCloud Gateway实现网关统一鉴权与路由,新建mf-admin管理端复用C端域服务(Dubbo调用),实现管理员登录与用户管理四件查询。核心套路:网关白名单+双体系JWT(同工具不同payload)、管理端零直连业务库、分页形态区分(MySQL自动count/Mongo手动count)、浏览器端独立聚合。踩坑12条,附自检清单与后续改造方向,可复用于多角色后台系统。

Wang的专栏 63

大表 ALTER TABLE 怎么做?NineData OnlineDDL 配置与执行实践

介绍NineData OnlineDDL大表变更实践,涵盖执行策略、切表控制、拷贝批次与可视化进度追踪。

dbasenewbie的博客 295

Axum 初步入门学习笔记

)自定义错误实现后,可以直接作为Result的ErrAxum 是一个构建在 Tokio、Tower、Hyper 之上的 Rust Web 框架,核心能力是:Router 路由、Extractor 提取器、Tower 中间件、IntoResponse 响应机制、State 共享状态。那张分层架构图是“地图”不是“说明书”:它帮你建立全局观,但 Service、Repository、数据库、Redis、MQ 都是你自己在 Handler 内部调用的业务/基础设施层,不是 Axum 自带的。

weixin_43219667的博客 205

MySQL报Too many open files?句柄耗尽的排查与参数配置

文章讲清 max_connections 与 open_files_limit 两个额度、句柄被谁占走、分区表为什么最容易踩,给出从 error log 到 /proc/pid/limits 的定位顺序与句柄预算算法。

「一个在数据库赛道上边学边分享的学妹」——聚焦国产数据库/信创方向、分享学习笔记、踩坑经验和行业观察。 338

SQL Server 数据库双备份:简化配置,兼顾本地留存与异机归档

本文针对中小企业SQLServer数据库备份难题,提出简化配置与本地+异机双副本方案。传统原生备份依赖手动脚本,存在配置复杂、传输易中断、日志分散、静默失败等问题。推荐使用图形化工具实现备份、本地留存与异机同步一体化管理,支持断点续传、加密传输、自动清理与版本控制,降低运维负担。双副本策略提升数据安全性,本地快速恢复,异地防硬件故障。建议定期验证恢复流程,确保备份可用性。

2501_93776716的博客 313
上一篇: COMP2240/COMP6240 - Operating Systems
下一篇: ELEC ENG 3110 Electric Power Systems
vx___codinghelp
博客等级 码龄2年 778粉丝 101原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值