首页 \ 问答 \ 我在verilog上以4:1的形式进行多路复用,但输出并不是经过考验的(I am doing a mux 4:1 on verilog, but the output is not the expeted)

我在verilog上以4:1的形式进行多路复用,但输出并不是经过考验的(I am doing a mux 4:1 on verilog, but the output is not the expeted)

我在互联网上看到了一些关于verilog的mux 4:1的例子。 我试图做一些事情,但输出不是被开除的。 这是来源:

module mux41 (a, b, c, d,select,z);

input a,b,c,d;
input [1:0]select;
output reg z;

always@(select )
begin
case (select)
    2'b00: assign z=a;
    2'b01: assign z=b;
    2'b10: assign z=c;
    2'b11: assign z=d;
endcase
end
endmodule

这是测试平台:

module mux41_tb;

reg at,bt,ct,dt;
reg [1:0] selectt;
wire zt;

mux41   test(.a(at),.b(bt),.c(ct),.d(dt),.select(selectt),
            .z(zt));

initial
begin
     $monitor ("a=%d",at,"b=%b",bt,"c=%b",ct,
                    "d=%b","select=%b",selectt,"z=%z",zt);

    selectt =2'b00;
    #5
    selectt =2'b01;
    #5
    selectt =2'b10;
    #5
    selectt =2'b11;
    #5;

end

endmodule

但输出如下:

在此处输入图像描述

我的问题是我在两个代码(源代码和测试平台)中应该有什么机会。

丁基,NIN。


I've seen some examples on internet about mux 4:1 on verilog. I've tried to do something but the output is not the expeted. This is the source :

module mux41 (a, b, c, d,select,z);

input a,b,c,d;
input [1:0]select;
output reg z;

always@(select )
begin
case (select)
    2'b00: assign z=a;
    2'b01: assign z=b;
    2'b10: assign z=c;
    2'b11: assign z=d;
endcase
end
endmodule

and this is the testbench :

module mux41_tb;

reg at,bt,ct,dt;
reg [1:0] selectt;
wire zt;

mux41   test(.a(at),.b(bt),.c(ct),.d(dt),.select(selectt),
            .z(zt));

initial
begin
     $monitor ("a=%d",at,"b=%b",bt,"c=%b",ct,
                    "d=%b","select=%b",selectt,"z=%z",zt);

    selectt =2'b00;
    #5
    selectt =2'b01;
    #5
    selectt =2'b10;
    #5
    selectt =2'b11;
    #5;

end

endmodule

but the output is the following :

enter image description here

My question is what I should chance in both codes (source and testbench).

Sincerylly, NIN.


原文:https://stackoverflow.com/questions/39129028
更新时间:2022-12-27 10:12

最满意答案

您可以将视图添加到布局中,如下所示:

ViewGroup layout = (ViewGroup) findViewById(R.id.your_layout_id);//your container's id in your activity_main.xml 
drawView = new DrawView(this); 
layout.addView(drawView);

You can add your view to your layout like this:

ViewGroup layout = (ViewGroup) findViewById(R.id.your_layout_id);//your container's id in your activity_main.xml 
drawView = new DrawView(this); 
layout.addView(drawView);

相关问答

更多
  • 只需在ScrollView使用android:fillViewport="true" Just use android:fillViewport="true" in your ScrollView
  • 以下代码更改将起作用: 对于textview,将'fill_parent'更改为'wrap_content'的高度和宽度。 为按钮和textview添加android:layout_weight="1" 。
  • 这怎么样(修复ID,所以他们不重复): ...
  • 我希望我的布局xml对你有帮助。 就我而言,所有按钮和TextView都位于Google地图上。 我正在使用新的Google Maps API v2,并且我的MainActivity扩展了“android.support.v4.app.FragmentActivity”。 这是我的完整xml;
    您可以将视图添加到布局中,如下所示: ViewGroup layout = (ViewGroup) findViewById(R.id.your_layout_id);//your container's id in your activity_main.xml drawView = new DrawView(this); layout.addView(drawView); You can add your view to your layout like this: ViewGroup layout ...
  • 是的,在您给出的示例中,它将首先从“布局”中获取。 当确定从哪里提取资源时,将首先检查与设备匹配的布局大小文件夹(即小设备将首先检查布局 - 小),如果有问题的特定资源不可用,那么它将检查“布局”。 当且仅当资源仍然不可用时,它才会开始检查与当前正在运行的设备不匹配的“layout-size”文件夹。 编辑:刚刚在小型设备上测试过。 我的发现再次肯定了我认为它会起作用的方式。 如果两者都存在资源,它肯定会从小型设备上的普通布局而不是布局正常。 Yes, In the example you've given ...
  • 您想要扩展的内容可能会有些混乱。 要根据内容的长度自动缩放TextView,可以使用wrap_content将高度设置为非具体值。 这个以及最小高度将为您提供始终显示您的内容的视图,但它们可能不适合在一个屏幕上(您可能必须将整个视图放在滚动视图或列表视图中以行作为元素)。 如果你想让文本本身“自动地”缩放......那么这有点困难,因为默认情况下这种行为不存在。 您必须使用TextView的Canvas测量剩余的空间,并找出用于可用空间的正确fontmetrics。 我会为此扩展TextView并覆盖各种o ...
  • 只是不要使用拖放并自己键入代码。 使用Ctrl +空格,将显示包含所有属性的列表。 现在你只需要知道你该做什么。 在你的例子中你需要一个视图“android:layout_toRightOf”其他只需键入右键,android studio会自动显示你想要的属性。 如果将视图放在另一个视图下面,您可以使用“android:layout_below”。 您可以在此处阅读所有属性
  • 为什么使用网格布局? 我认为最好使用水平方向的linearLayout ( layout_width = match_parent和layout_height = 200dp ),然后将它的weighSum指定为3,然后将这些视图放在此linearLayout , layout_width = 0 , layout_weight = 1和gravity = center 。 Why do you use grid layout? I think it would be better to use a lin ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。