1
- module top (bus, clk, out, clr);
2
- output tri [7 :0 ] bus;
1
+ module top (bus_high, bus_low, clk, out, clr);
2
+ output tri [3 :0 ] bus_high;
3
+ output tri [3 :0 ] bus_low;
3
4
output [7 :0 ] out;
4
5
input clk, clr;
5
6
// Globals
6
- wire [3 :0 ] bus_high, bus_low ;
7
+ wire [7 :0 ] bus ;
7
8
wire buf_clk;
8
9
9
10
// Control signals
@@ -33,14 +34,14 @@ module top(bus, clk, out, clr);
33
34
bufif1 (buf_clk, clk, low_halt);
34
35
35
36
program_counter pc (
36
- .inc(inc), .clk(buf_clk), .pc_out_en(pc_out_en), .clr(clr), .out(bus_low )
37
+ .inc(inc), .clk(buf_clk), .pc_out_en(pc_out_en), .clr(clr), .out(bus[ 3 : 0 ] )
37
38
);
38
39
39
40
wire [3 :0 ] mar_out;
40
41
wire ld_mar;
41
42
not (ld_mar, low_ld_mar);
42
43
dff_posedge #(4 ) mar (
43
- .d(bus_low ), .q(mar_out), .i_en(ld_mar), .clr(clr), .clk(buf_clk)
44
+ .d(bus[ 3 : 0 ] ), .q(mar_out), .i_en(ld_mar), .clr(clr), .clk(buf_clk)
44
45
);
45
46
46
47
rom16_8bit mem (
@@ -51,37 +52,37 @@ module top(bus, clk, out, clr);
51
52
wire ld_ir;
52
53
not (ld_ir, low_ld_ir);
53
54
dff_posedge #(8 ) ir (
54
- .d({bus_high, bus_low} ), .q(ir_out), .i_en(ld_ir), .clr(clr), .clk(buf_clk)
55
+ .d(bus ), .q(ir_out), .i_en(ld_ir), .clr(clr), .clk(buf_clk)
55
56
);
56
57
57
- tribuf_4bit buf0 (.in(ir_out[3 :0 ]), .out(bus_low ), .low_enable(low_ir_out_en));
58
+ tribuf_4bit buf0 (.in(ir_out[3 :0 ]), .out(bus[ 3 : 0 ] ), .low_enable(low_ir_out_en));
58
59
assign op_code = ir_out[7 :4 ]; // Directly pass to control_sequencer
59
60
60
61
61
62
wire [7 :0 ] acc_out;
62
63
wire ld_acc;
63
64
not (ld_acc, low_ld_acc);
64
65
dff_posedge #(8 ) acc (
65
- .d({bus_high, bus_low} ), .q(acc_out), .i_en(ld_acc), .clr(clr), .clk(buf_clk)
66
+ .d(bus ), .q(acc_out), .i_en(ld_acc), .clr(clr), .clk(buf_clk)
66
67
);
67
68
wire low_acc_out_en;
68
69
assign low_acc_out_en = ~ acc_out_en;
69
- tribuf_8bit buf1 (.in(acc_out), .out({bus_high, bus_low} ), .low_enable(low_acc_out_en));
70
+ tribuf_8bit buf1 (.in(acc_out), .out(bus ), .low_enable(low_acc_out_en));
70
71
71
72
wire [7 :0 ] b_reg_out;
72
73
wire ld_b_reg;
73
74
not (ld_b_reg, low_ld_b_reg);
74
75
dff_posedge #(8 ) b_reg (
75
- .d({bus_high, bus_low} ), .q(b_reg_out), .i_en(ld_b_reg), .clr(clr), .clk(buf_clk)
76
+ .d(bus ), .q(b_reg_out), .i_en(ld_b_reg), .clr(clr), .clk(buf_clk)
76
77
);
77
78
78
- adder_sub_8 asub (.A(acc_out), .B(b_reg_out), .sub(sub_add), .cout(), .out({bus_high, bus_low} ), .out_en(subadd_out_en));
79
+ adder_sub_8 asub (.A(acc_out), .B(b_reg_out), .sub(sub_add), .cout(), .out(bus ), .out_en(subadd_out_en));
79
80
80
81
wire ld_out_reg;
81
82
not (ld_out_reg, low_ld_out_reg);
82
83
dff_posedge #(8 ) out_reg (
83
- .d({bus_high, bus_low} ), .q(out), .i_en(ld_out_reg), .clr(clr), .clk(buf_clk)
84
+ .d(bus ), .q(out), .i_en(ld_out_reg), .clr(clr), .clk(buf_clk)
84
85
);
85
86
86
- assign bus = {bus_high, bus_low};
87
+ assign {bus_high, bus_low} = bus ;
87
88
endmodule
0 commit comments