Encerrado

verilog program

Problem 1: Write a structural model for a 5-bit equality tester. Specifications: • The equal output should be high whenever there are equal values on inputs in1 and in2. • Use regs only for driving the inputs. The design itself should be purely combinational. • Do not use the == operator to compare in1 and in2. This is to be a structural model using only gates and module instantiations! • Test your design using the following sets of inputs, shown as “decimal (binary)??: in1 in2 4(00100) 27(11011) 6(00110) 24(11000) 3(00011) 31(11111) 21(10101) 13(01101) 27(11011) 11(01011) 15(01111) 15(01111) Hints: • Compare each bit of in1 with the corresponding bit of in2 (that is, in1[0] with in2[0], in1[1] with in2[1], etc.). If every pair of bits is equal, the two inputs equal. • In the above table, note that for the first pair of inputs (4 and 27), bits 0 through all mismatch. The second pair (6 and 24) mismatches for all bits except bit third pair mismatches for all bits except bits 0 and 1, and so forth. You can the individual bit comparisons to confirm that another bit pair is matching with each successive pair of inputs, until all bit pairs match at the last pair of inputs. Problem 2: Write a structural model for a 5-bit 2-to-1 multiplexer. Specifications: • When sel = 0, out = in1. When sel = 1, out = in2. • Use regs only for driving the inputs. The design itself should be purely combinational. • Do not use an if-else structure or the conditional operator (“?:??) to select between in1 and in2. This is to be a structural model using only gates and module instantiations! • Test your design using the following sets of inputs: in1 in2 sel 4(00100) 27(11011) 0 6(00110) 24(11000) 1 3(00011) 31(11111) 0 21(10101) 13(01101) 1 27(11011) 11(01011) 0 Hints: • Use predefined gates to build a module containing a one-bit 2-to-1 multiplexer. • You may use the 2-to-1 multiplexer design presented in class (but add ports!) • Instantiate the one-bit multiplexer 5 times inside another module. • Connect the 5 multiplexers in parallel, using the same sel signal for all of them. • The values for in1 and in2 are the same as for Problem 1, except that the last case from Problem 1 is omitted here. If your results are not correct, use the differing bit in each case to see if the proper input is being selected. Problem 3: Write a structural model for a 5-bit adder. Specifications:• out = in1 + in2

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request. 3) Complete ownership and distribution copyrights to all work purchased. For each of the problems described: • Submit all the Verilog code that you write. • Use statements such as $display and $monitor in your code to show both your inputs and the resulting outputs. You may also include internal signals in your output if you wish (optional). cont 3 • Use regs only for driving the inputs. The design itself should be purely combinational. • Do not use the + operator to add in1 and in2. This is to be a structural model using only gates and module instantiations! • Test your design using the following sets of inputs: in1 in2 5 9 11 18 21 6 8 15 27 23 Hints: • Use predefined gates to build a module containing a one-bit adder without carryin and a one-bit adder with carry-in. • You may use the full adder designs presented in class (but add ports!) • Instantiate the full adder without carry-in once inside another module. This will be the adder for the least significant bits of in1 and in2. • Instantiate the full adder with carry-in 4 times inside the same module where you instantiated the adder without carry-in. These four instances will handle the highest 4 bits of the inputs. • Connect each carry-out to the carry-in of the next higher adder. • Output bit out[5] is the carry-out of the highest adder. • Each pair of inputs in the table above generates a carry-out from only one of the adders, except the last case, which generates carry-outs from all the adders. If your results are not correct, check to see that the carry-out is being generated as expected and is being counted in the next higher adder. Class Examples for Assignment 1 Equality tester using xnor: module equality1; reg in1, in2; // drive xnor’s inputs wire equal; // wire for xnor’s outputs xnor eq_test (equal, in1, in2); // instance of xnor initial begin // Set the inputs for the xnor in1 = 1'b1; in2 = 1'b1; // Wait 1 time unit, then print the inputs #1 $display("in1 = %b",in1); $display("in2 = %b",in2); // Print the result $display("equal = %b",equal); end endmodule Equality tester using and, nor and or: module equality2; reg in1, in2; // regs for inputs wire equal; // wire for result wire both_low // high if both inputs low wire both_high; // high if both inputs high // Instantiate gates // Test inputs to see if both are low nor testfor0 (both_low, in1, in2); // Test inputs to see if both are high and testfor1 (both_high, in1, in2); // If either of the above is true, inputs are equal or result (equal, both_low, both_high); initial begin // Set the inputs in1 = 1'b1; in2 = 1'b1; // Wait 1 time unit, then print the inputs #1 $display("in1 = %b",in1); $display("in2 = %b",in2); // Print the result $display("equal = %b",equal); end endmodule 2-to-1 Multiplexer: module mux_2to1; reg in1, in2; // inputs reg sel; // input selector wire out; // output wire a; // = in1 if sel = 0 wire b; // = in2 if sel = 1 wire not_sel; // inverse of sel // Instantiate gates // Invert the sel input not inv_sel (not_sel, sel); // Generate a and b (see declarations above) // If sel = 0, select in1; if sel = 1, select in2 and sel_in1 (a, in1, not_sel); and sel_in2 (b, in2, sel); // If a or b is high, the selected input is high, // so the output is also high or result (out, a, b); initial begin // Set the inputs in1 = 1'b1; in2 = 1'b0; sel = 1'b1; // Wait 1 time unit, then print the inputs #1 $display("in1 = %b",in1); $display("in2 = %b",in2); $display("sel = %b",sel); // Print the result $display("out = %b",out); end endmodule Full adder without carry-in: module full_adder;

## Platform

windows reg in1, in2; // inputs wire sum, c_out; // sum and carry-out // Instantiate gates ??" generate sum and carry-out xor sum1and2 (sum, in1, in2); and carry_out (c_out, in1, in2); initial begin // Set the inputs in1 = 1'b1; in2 = 1'b0; // Wait 1 time unit, then print the inputs #1 $display("in1 = %b",in1); $display("in2 = %b",in2); // Print the results $display("sum = %b",sum); $display("c_out = %b",c_out); end endmodule send the rest later (did not have enough space)

Habilidades: Engenharia, Microsoft, MySQL, PHP, Arquitetura de software, Teste de Software, Área de trabalho do Windows

Ver mais: inv_sel, use case module, true results, the sum of 11 times s and 3, sum binary, structural design work, set of pairs, set bits in c, set bits, problems with match, problem statements, match problems, low bits, examples of problem statements, examples of assignment problem, conditional design, c code for assignment problem, bit bits, bit binary, binary problems, binary problem, binary code test, binary bit, assignment problems in or, assignment problem examples

Acerca do Empregador:
( 16 comentários ) United States

ID do Projeto: #2973551

1 freelancer está ofertando em média $85 para este trabalho

dexter9

See private message.

$85 USD in 5 dias
(1 Comentário)
1.9