
HDLBits---Vector
HDLBits---Vector练习
材料狗转行ing
这个作者很懒,什么都没留下…
展开
-
09-Vector-向量拼接后异或操作
Verilog HDL(HDLBits)Verilog Language Basic09-Vector-向量拼接后异或操作module top_module ( input a, b, c, d, e, output [24:0] out );// // assign out = ~{ ... } ^ { ... }; //拼接时若有倍数,必须用要用大括号括起来再拼, assign out = ~{{5{a}},{5{b}},{5{c}},{原创 2022-01-28 20:20:06 · 533 阅读 · 0 评论 -
08-Vector-向量内索引翻倍
Verilog HDL(HDLBits)Verilog Language Basic08-Vector-向量内索引翻倍创建一个32位的输出电路进行接收。输出电路接收的值:将8位的输入电路中的符号位复制24次,剩余8个位宽放原来的输入值,由于符号位位于in[7]这个索引,将该索引的符号位复制24次,(可能描述有点小问题,但是不影响理解)代码如下module top_module ( input [7:0] in, output [31:0] out );// // assi原创 2022-01-28 19:48:47 · 377 阅读 · 0 评论 -
07-Vector-向量翻转
Verilog HDL(HDLBits)Verilog Language Basic07-Vector-向量翻转Given an 8-bit input vector [7:0], reverse its bit ordering.(将该向量翻转,第一位变最后一位,倒数第二变第二,以此类推)module top_module( input [7:0] in, output [7:0] out); integer i;//引入一个整型变量 always@(*)原创 2022-01-27 22:24:11 · 974 阅读 · 0 评论 -
06-Vector-向量拼接
Verilog HDL(HDLBits)Verilog Language Basic06-Vector-向量拼接module top_module ( input [4:0] a, b, c, d, e, f, output [7:0] w, x, y, z );// // assign { ... } = { ... } 将input的6条5位宽的wire线拼接在一起一条30个位宽的线,并且输出到由4条8个位宽拼接成一条32位的线 assign {w[7:0]原创 2022-01-27 22:03:06 · 670 阅读 · 0 评论 -
05-Vector-向量内的逻辑运算
Verilog HDL(HDLBits)Verilog Language Basic05-Vector-向量内的逻辑运算module top_module( input [3:0] in, output out_and, output out_or, output out_xor ); //assign out_and = in[3] & in[2] & in[1] & in[0]; assign out_and = &a原创 2022-01-27 21:37:11 · 895 阅读 · 0 评论 -
04-Vector-向量内逻辑运算
Verilog HDL(HDLBits)Verilog Language Basic04-Vector-向量内逻辑运算构建一个电路,该电路具有两个3位输入,用于计算两个向量的按位OR、两个向量的逻辑OR和两个向量的逆(NOT)。将b的逆放在out_no的上半部分(即位[5:3]),在下半部分放置a的逆。module top_module( input [2:0] a, input [2:0] b, output [2:0] out_or_bitwise, outp原创 2022-01-27 21:02:55 · 1593 阅读 · 0 评论 -
03-Vector-逆转字节
Verilog HDL(HDLBits)Verilog Language Basic03-Vector-逆转字节A 32-bit vector can be viewed as containing 4 bytes (bits [31:24], [23:16], etc.). Build a circuit that will reverse the byte ordering of the 4-byte word.将32位向量视为包含4个字节(位[31:24],[23:16]等)。建立一个电路,该原创 2022-01-27 20:24:35 · 432 阅读 · 0 评论 -
02-Vectors
Verilog HDL(HDLBits)Verilog Language Basic02-Vectors建立一个组合电路,将输入半字(16位,[15:0])分成低[7:0]和高[15:8]module top_module( input wire [15:0] in, output wire [7:0] out_hi, output wire [7:0] out_lo ); //故意写错索引方向 /* assign out_lo = in[0原创 2022-01-27 20:15:17 · 120 阅读 · 0 评论 -
01-Vector
Verilog HDL(HDLBits)Verilog Language Basic01-Vectormodule top_module ( input wire [2:0] vec, output wire [2:0] outv, output wire o2, output wire o1, output wire o0 ); // Module body starts after module declaration //未切换位置原创 2022-01-27 19:45:31 · 176 阅读 · 0 评论