文章分类 -  Hdlbits的Verilog学习

摘要:You are provided with a BCD one-digit adder named bcd_fadd that adds two BCD digits and carry-in, and produces a sum and carry-out. module bcd_fadd ( 阅读全文
posted @ 2023-04-20 11:26 江左子固 阅读(57) 评论(0) 推荐(0)
摘要:Create a 100-bit binary ripple-carry adder by instantiating 100 full adders. The adder adds two 100-bit numbers and a carry-in to produce a 100-bit su 阅读全文
posted @ 2023-04-20 11:01 江左子固 阅读(72) 评论(0) 推荐(0)
摘要:A "population count" circuit counts the number of '1's in an input vector. Build a population count circuit for a 255-bit input vector. Popcount255 - 阅读全文
posted @ 2023-04-20 10:52 江左子固 阅读(30) 评论(0) 推荐(0)
摘要:Given a 100-bit input vector [99:0], reverse its bit ordering. Vector100r - HDLBits (01xz.net) 1 module top_module( 2 input [99:0] in, 3 output [99:0] 阅读全文
posted @ 2023-04-20 10:48 江左子固 阅读(37) 评论(2) 推荐(0)
摘要:Build a combinational circuit with 100 inputs, in[99:0]. There are 3 outputs: out_and: output of a 100-input AND gate. out_or: output of a 100-input O 阅读全文
posted @ 2023-04-20 10:44 江左子固 阅读(9) 评论(0) 推荐(0)
摘要:You're already familiar with bitwise operations between two values, e.g., a & b or a ^ b. Sometimes, you want to create a wide gate that operates on a 阅读全文
posted @ 2023-04-20 10:36 江左子固 阅读(22) 评论(0) 推荐(0)
摘要:Verilog has a ternary conditional operator ( ? : ) much like C: (condition ? if_true : if_false) This can be used to choose one of two values based on 阅读全文
posted @ 2023-04-20 10:28 江左子固 阅读(39) 评论(0) 推荐(0)
摘要:Suppose you're building a circuit to process scancodes from a PS/2 keyboard for a game. Given the last two bytes of scancodes received, you need to in 阅读全文
posted @ 2023-04-20 10:12 江左子固 阅读(20) 评论(0) 推荐(0)
摘要:Build a priority encoder for 8-bit inputs. Given an 8-bit vector, the output should report the first (least significant) bit in the vector that is 1. 阅读全文
posted @ 2023-04-20 09:58 江左子固 阅读(39) 评论(0) 推荐(0)
摘要:A priority encoder is a combinational circuit that, when given an input bit vector, outputs the position of the first 1 bit in the vector. For example 阅读全文
posted @ 2023-04-20 00:27 江左子固 阅读(58) 评论(0) 推荐(0)
摘要:Case statements in Verilog are nearly equivalent to a sequence of if-elseif-else that compares one expression to a list of others. Its syntax and func 阅读全文
posted @ 2023-04-20 00:15 江左子固 阅读(13) 评论(0) 推荐(0)
摘要:When designing circuits, you must think first in terms of circuits: I want this logic gate I want a combinational blob of logic that has these inputs 阅读全文
posted @ 2023-04-19 23:58 江左子固 阅读(20) 评论(0) 推荐(0)
摘要:This is equivalent to using a continuous assignment with a conditional operator: assign out = (condition) ? x : y; However, the procedural if statemen 阅读全文
posted @ 2023-04-19 23:46 江左子固 阅读(12) 评论(0) 推荐(0)
摘要:For hardware synthesis, there are two types of always blocks that are relevant: Combinational: always @(*) Clocked: always @(posedge clk) Clocked alwa 阅读全文
posted @ 2023-04-19 23:33 江左子固 阅读(46) 评论(0) 推荐(0)
摘要:Since digital circuits are composed of logic gates connected with wires, any circuit can be expressed as some combination of modules and assign statem 阅读全文
posted @ 2023-04-19 23:24 江左子固 阅读(24) 评论(0) 推荐(0)
摘要:One drawback of the ripple carry adder (See previous exercise) is that the delay for an adder to compute the carry out (from the carry-in, in the wors 阅读全文
posted @ 2023-04-19 14:23 江左子固 阅读(62) 评论(0) 推荐(0)
摘要:In this exercise, you will create a circuit with two levels of hierarchy. Your will instantiate two copies of (provided), each of which will instantia 阅读全文
posted @ 2023-04-19 14:01 江左子固 阅读(70) 评论(4) 推荐(0)
摘要:You are given a module that performs a 16-bit addition. Instantiate two of them to create a 32-bit adder. One add16 module computes the lower 16 bits 阅读全文
posted @ 2023-04-19 12:11 江左子固 阅读(32) 评论(0) 推荐(0)
摘要:This exercise is an extension of module_shift. Instead of module ports being only single pins, we now have modules with vectors as ports, to which you 阅读全文
posted @ 2023-04-19 11:41 江左子固 阅读(36) 评论(0) 推荐(0)
摘要:You are given a module my_dff with two inputs and one output (that implements a D flip-flop). Instantiate three of them, then chain them together to m 阅读全文
posted @ 2023-04-19 10:56 江左子固 阅读(14) 评论(0) 推荐(0)