zoukankan      html  css  js  c++  java
  • 【原创】The solutional manual of the Verilog HDL: A Guide to Digital Design and Synthesis (2nd)ch04

    Chapter 4. Modules and Ports

    4.5 Exercises

    1. What are the basic components of a module? Which components are mandatory?

    my answer:

    1) Module Name, Port List, Port Declarations, Parameters, Declarations of wires, regs and other variables, Data flow statements, Instantiation of lower level modules, always and initial blocks, Tasks and functions, endmodule statement.

    2) module, module name,and endmodule.

    2. Does a module that does not interact with its environment have any I/O ports? Does it have a port list in the module definition?

    my answer:

    1) have

    2) no

    3. A 4-bit parallel shift register has I/O pins as shown in the figure bellow. Write the module definition for this module shift_reg. Include the list of ports and port declarations. You do not need to show the internals.

    clip_image002

    my answer:

    module shift_reg(reg_out,reg_in,clock);

    output reg [3:0]reg_out;

    input [3:0]reg_in;

    input clock;

    endmodule

    4. Declare a top-level module stimulus. Define REG_IN(4-bit)and CLK(1-bit)as reg register variables and REG_OUT(4-bit)as wire. Instanitiate the module shift_reg and call it sr1. Connect the ports by ordered list.

    my answer:

    module stimulus;

    reg [3:0]REG_IN;

    reg CLK;

    wire [3:0]REG_OUT;

    shift_reg sr1(REG_OUT,REG_IN,CLK);

    endmodule

    5. Connect the ports in Step 4 by name.

    my answer:

    shift_reg(.reg_out(REG_OUT),.reg_in(REG_IN),.clock(CLK));

    6.Write the hierarchical names for variables REG_IN,CLK,REG_OUT;

    my answer:

    stimulus.REG_IN, stimulus.CLK, stimulus.REG_OUT

    7. Write the hierarchical name for the instance sr1. Write the hierarchical names for its ports clock and reg_in.

    my answer:

    stimulus.sr1,

    stimulus.sr1.clock

    stimulus.sr1.reg_in

    Reference

    Smair Palnitkar, <Verilog HDL: A Guide to Digital Design and Synthesis (2nd) >

  • 相关阅读:
    【LOJ #3058】「HNOI2019」白兔之舞(单位根反演+矩阵快速幂+MTT)
    【LOJ #2289】「THUWC 2017」在美妙的数学王国中畅游(LCT+泰勒展开)
    【LOJ #3193】「ROI 2019 Day2」机器人高尔夫球赛(DP+Map)
    【Codeforces 1119H】Triple(FWT)
    PKUWC2020 (旅)游记
    多项式算法合集
    redis入门学习
    servelt
    spring容器原理学习
    Spring MVC
  • 原文地址:https://www.cnblogs.com/halflife/p/1982152.html
Copyright © 2011-2022 走看看