Aim of The Experiment Design and Implementation of A 16 Bit Program Counter
Aim of The Experiment Design and Implementation of A 16 Bit Program Counter
The add, sub, offset inputs are ignored and the contents of the PC
register are simply incremented by one.
2. When add or sub is high, the add or subtract operation
respectively is performed, during which the value offset is
added to or subtract from the PC register contents, and the
result is stored back in the PC register.
3. When inc, add and sub are all low, PC register value remains
unchanged. It is guaranteed that at most one of inc, add or
sub will be high in a clock cycle.
DESIGN AND SIMULATION
iverilog -o tb_pc lib.v pc.v tb_pc.v
vvp tb_pc
gtkwave tb_pc.vcd
•
pc.v Module 1
module fa (input wire i0, i1, cin, output wire sum,
cout);
wire t0, t1, t2;
xor3 _i0 (--------------------);
and2 _i1 (----------------------);
and2 _i2 (-----------------------);
and2 _i3 (------------------);
or3 _i4 (--------------------);
endmodule
pc.v Module 2
module addsub (input wire addsub, i0, i1, cin,
output wire sumdiff, cout);
wire t;
fa _i0 (--------------------);
xor2 _i1 (--------------------);
endmodule
pc.v Module 3
module pc_slice (input wire clk, reset, cin, load,
inc, sub, offset, output wire cout, pc);
wire in, inc_;
invert invert_0 (-------------);
and2 and2_0 (-----------------);
addsub addsub_0 (----------------------);
dfrl dfrl_0 (------------------------);
endmodule
pc.v Module 4
module pc_slice0 (input wire clk, reset, cin, load,
inc, sub, offset, output wire cout, pc);
wire in;
or2 or2_0 (--------------------);
addsub addsub_0 (----------------);
dfrl dfrl_0 (----------------------);
endmodule
pc.v Module 5
module pc (input wire clk, reset, inc, add, sub, input wire [15:0] offset,
output wire [15:0] pc);
input wire load; input wire [15:0] c;
or3 or3_0 (------------------);
pc_slice0 pc_slice_0 (clk, reset, sub, load, inc, sub, offset[0], c[0], pc[0]);
pc_slice pc_slice_1 (clk, reset, c[0], load, inc, sub, offset[1], c[1], pc[1]);
-----------------------------------------------------------------------------------------------
pc_slice pc_slice_15 (clk, reset, c[14], load, inc, sub, offset[15], c[15],
pc[15]);
endmodule
OUTPUT TABLE