Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have a Basys 3 board and I am having the hardest time figuring out how to prog

ID: 2085536 • Letter: I

Question

I have a Basys 3 board and I am having the hardest time figuring out how to program it so that all the LED lights turn on when you turn the switches up.

Right now this is the codes i have written to turn one 1 led on with a switch but I need to each switch to turn one each LED please help me.

The first photo is the source file and the second photo is the constraints.

led,sw.v * × project2.xdc" C./Engineering 214/project_2/project_2.srcs/sources_1/newled_sw.v 1 timescale 1ns/1ps 2 module led SW output led, input svw 5 : assign led = sw; 9endmodule

Explanation / Answer

To assign one toggel switch for one LED we can go for various coding tehniques like Verilog or VHDL. Following is the Verilog code that can help regarding the same,

module chegg(sw,out_led); // defining a module with input and output
input [15:0] sw;               // defining sw as a 16 bit input
output [15:0] out_led;       // defining out_led as a 16 bit ouput
reg [15:0] s;                   // defining an intermediate registor s to assign the values of sw
reg [15:0] out_led;           // defining a registor with the same name and dimention to that of the out_led
always @(sw) begin           // condition is always valid if there is any change in sw
   s=sw;                           // assignment of the values of the sw to s  
   out_led=s;                   // assignment of the values of the s to out_led
end                               // end of always
endmodule                       // end of module

This verilog code is able to assign the values of any toggle switch to any LED. The assignment of the proper LEDs and switches has to be done by the user i.e. sw[0], sw[1], sw[2],.......... sw[15] and out_led[0], out_led[1], out_led[2]........... out_led[15 ]has to be assigned witch proper toggel switch codes that would be given in BASYS 3 user manual.