Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
Organization These slides give a series of self-paced exercises. Read the specification of each exercise and write your code before proceeding to the solution slide. These exercises will be most useful if you have access to a verilog simulator (modelsim, Icarus verilog) as you read these slides. See Dr. Barnes if you need help installing a simulator.
Ex 1 Solution module shifter(in, out, s); input [1:0] in; input s; output [1:0] out; wire s; wire [1:0] in; wire out; assign out[1] = (~s) & in[1] | s & in[0]; assign out[0] = (~s) & in[0]; endmodule
Ex 2 – 3:8 row decoder with enable
Ex 3 – 8b register with load and synchronous reset
Ex 3 Solution module ld_reg8(din, clk, rst, ld, q); input [7:0] din; input clk, rst, ld; output [7:0] q; wire [7:0] din, q_nxt; wire clk, rst, ld; reg [7:0] q; //Logic on register inputs assign q_nxt = ld? din : q; // Update register always @(posedge clk) q <= rst? 8'h0 : q_nxt; endmodule // row_decoder