// a 3-input look-up-table

// In this question, you will design a circuit for an 8x1 memory,
// where writing to the memory is accomplished by shifting-in bits,
// and reading is "random access", as in a typical RAM.
// You will then use the circuit to realize a 3-input logic function.
// First, create an 8-bit shift register with 8 D-type flip-flops. D触发器
// Label the flip-flop outputs from Q[0]...Q[7]. The shift register input should be called S,
// which feeds the input of Q[0] (MSB is shifted in first).
// The enable input controls whether to shift.
// Then, extend the circuit to have 3 additional inputs A,B,C and an output Z.
// The circuit's behaviour should be as follows:
// when ABC is 000, Z=Q[0], when ABC is 001, Z=Q[1], and so on.
// Your circuit should contain ONLY the 8-bit shift register,
// and multiplexers. (Aside: this circuit is called a 3-input look-up-table (LUT)). module top_module (
input clk,
input enable,
input S,
input A, B, C,
output reg Z ); reg [7:0] Q;
always @(posedge clk) begin
if(enable)begin
Q <= {Q[6:0],S};
end
else Q <=Q;
end always @(*) begin
case ({A,B,C})
3'b000: Z = Q[0];
3'b001: Z = Q[1];
3'b010: Z = Q[2];
3'b011: Z = Q[3];
3'b100: Z = Q[4];
3'b101: Z = Q[5];
3'b110: Z = Q[6];
3'b111: Z = Q[7];
endcase
end
endmodule

测试结果

RTL原理图

HDLbits—— 3-input look-up-table的更多相关文章

  1. el-popover 点击input框出现table表,可点击选中,可拼音检索完回车选中

    <template> <card> <el-popover placement="right" width="400" trigg ...

  2. js 因加入form导致两个table之间出现空白问题

    在<FORM>中加CSS <table> ....... </table> <form style="padding:0; margin:0;&qu ...

  3. jq 克隆 移除table

    function addRow2(node){ var obj = $("tr[name='info']:last"); var objClone = $(obj).clone() ...

  4. java html table 转 excel,给予jdom 和 poi

    maven 引入 <dependency> <groupId>org.jdom</groupId> <artifactId>jdom</artif ...

  5. 在 easyui中获取form表单中所有提交的数据 拼接到table列表中

    form表单===== <!-- 并用药品填写信息弹框 --> <div id="usingProdctMsgDiv" style="display: ...

  6. 周末惊魂:因struts2 016 017 019漏洞被入侵,修复。

    入侵(暴风雨前的宁静) 下午阳光甚好,想趁着安静的周末静下心来写写代码.刚过一个小时,3点左右,客服MM找我,告知客户都在说平台登录不了(我们有专门的客户qq群).看了下数据库连接数,正常.登录阿里云 ...

  7. jQuery九类选择器详解

    (1)基本选择器 <body> <div id="div1ID">div1</div> <div id="div2ID" ...

  8. hive 内部表和外部表的区别和理解

    1. 内部表 create table test (name string , age string) location '/input/table_data'; 注:hive默认创建的是内部表 此时 ...

  9. php之验证码小程序

    验证码功能(个人理解): 减轻服务器的压力(如12306的验证码功能): 防止暴力注册 个人思路:在a-z,A-Z,1-9生成n位随机的数来构成新的验证码. 关于生成验证码的几个小函数 range() ...

  10. 【转】Hive内部表、外部表

    hive内部表.外部表区别自不用说,可实际用的时候还是要小心. 1. 内部表: create table tt (name string , age string) location '/input/ ...

随机推荐

  1. FPGA MIG调试bug(一)

    目标器件:复旦微FPGA:JFM7K325T8FCBGA676(对标Xilinx Kintex-7系的XC7K325T) 工程背景:板载4片DDR(AllianceMemory_DDR3L_8G_AS ...

  2. asp.net.core学习笔记1:swagger的使用和webapi接收Jobject对象

    环境:asp.net.core 3.1 (一觉醒来官方已经不推荐3.0了,于是没有任何core经验,也只能开始了3.1的开发学习) 由于现有项目前后端分离.微服务化日趋流行,所以上手不采用web应用( ...

  3. 删除指定 route ip 段

    route del -net 172.18.0.0 netmask 255.255.0.0

  4. 那些年我们用过的xshell小彩蛋

    优化PS1变量 vi /etc/profile.d/ps1.sh _set_prompt () { #see: http://misc.flogisoft.com/bash/tip_colors_an ...

  5. Mac卡顿 CPU占100%的原因Photolibraryd

    找到了造成电脑卡顿的元凶,第一步要做的就是杀进程,选中这两个进程,点击上面的结束按钮,世界立马恢复了宁静,高兴的继续码代码,可是好景不长,大约一个小时以后,又特么卡了,"任务管理器" ...

  6. 关于sqlsugar二级缓存

    二级缓存 1.优点 (1).维护方便:SqlSugar的 二级缓存 支持单表和多表的 CRUD 自动缓存更新 ,减少了复杂的缓存KEY维护操作 (2).使用方便:可以直接在Queryable.With ...

  7. Tooltip 文字提示,居中显示

    Tooltip 文字提示有时候在table中无法居中显示,这个可以设置一下 <a-tooltip placement="top" overlayClassName=" ...

  8. Jmeter:随机类函数

    一.__Random 功能介绍:计算范围内的随机数 ${__Random(参数 1,参数 2,参数 3)} 参数 1:开始数字,包括在内 参数 2:结束数字,包括在内 参数 3:注册变量名称  二._ ...

  9. ES 基础操作

    集群 健康值的三种状态 Green:所有索引的所有分片均可用 primary 和 replice 均可用. Yellow 至少有一个 replice不可以用, 但是所有的 primary 正常. Re ...

  10. ubuntu22.04安装 kubernetes(docker)

    初始化检查 操作系统:ubuntu22.04 LTS docker:20.10.18 kubelet: v1.23.6 kubeadm:v1.23.6 kubectl: v1.23.6 1.校准时间: ...