Compare commits
No commits in common. "139ec3c0c0c75ce83119980b3f56188c5d7b06bd" and "bc2ef977d8349d8aece1ccb90210f4e8a9377327" have entirely different histories.
139ec3c0c0
...
bc2ef977d8
@ -1,4 +1,4 @@
|
|||||||
SOURCES=processor.v testbench.v memory.v
|
SOURCES=processor.v testbench.v
|
||||||
VVP=processor.vvp
|
VVP=processor.vvp
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
// 0x00000000
|
|
||||||
55AA
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
||||||
0000
|
|
@ -1,18 +1,18 @@
|
|||||||
[*]
|
[*]
|
||||||
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
|
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
|
||||||
[*] Wed Feb 8 11:44:52 2023
|
[*] Wed Feb 8 09:34:17 2023
|
||||||
[*]
|
[*]
|
||||||
[dumpfile] "/home/user/UNI_DATA/COMS30046_2022_TB-2/projects/9086/cpu/test.lx2"
|
[dumpfile] "/home/user/UNI_DATA/COMS30046_2022_TB-2/projects/9086/cpu/test.lx2"
|
||||||
[dumpfile_mtime] "Wed Feb 8 11:44:20 2023"
|
[dumpfile_mtime] "Wed Feb 8 09:33:52 2023"
|
||||||
[dumpfile_size] 430
|
[dumpfile_size] 362
|
||||||
[savefile] "/home/user/UNI_DATA/COMS30046_2022_TB-2/projects/9086/cpu/gtkwave_savefile.gtkw"
|
[savefile] "/home/user/UNI_DATA/COMS30046_2022_TB-2/projects/9086/cpu/gtkwave_savefile.gtkw"
|
||||||
[timestart] 0
|
[timestart] 0
|
||||||
[size] 1342 1059
|
[size] 1630 1059
|
||||||
[pos] -1 -1
|
[pos] -1 -1
|
||||||
*-20.795050 2883000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
*-20.795050 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||||
[treeopen] tb.
|
[treeopen] tb.
|
||||||
[sst_width] 221
|
[sst_width] 221
|
||||||
[signals_width] 293
|
[signals_width] 214
|
||||||
[sst_expanded] 1
|
[sst_expanded] 1
|
||||||
[sst_vpaned_height] 313
|
[sst_vpaned_height] 313
|
||||||
@28
|
@28
|
||||||
@ -20,11 +20,7 @@ tb.p.clock[0]
|
|||||||
tb.p.reset[0]
|
tb.p.reset[0]
|
||||||
tb.p.start[0]
|
tb.p.start[0]
|
||||||
tb.p.state[1:0]
|
tb.p.state[1:0]
|
||||||
tb.p.instruction_finished[0]
|
|
||||||
@22
|
|
||||||
tb.p.external_address_bus[19:0]
|
|
||||||
tb.p.external_data_bus[15:0]
|
|
||||||
@29
|
@29
|
||||||
tb.p.read[0]
|
tb.p.instruction_finished[0]
|
||||||
[pattern_trace] 1
|
[pattern_trace] 1
|
||||||
[pattern_trace] 0
|
[pattern_trace] 0
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
module rom(input [19:0] address,output wire [15:0] data ,input rd,input cs);
|
|
||||||
reg [15:0] memory [15:0];
|
|
||||||
initial begin
|
|
||||||
$readmemh("boot_code.txt", memory);
|
|
||||||
end
|
|
||||||
assign data = !rd & !cs ? memory[address]: 'hz;
|
|
||||||
endmodule
|
|
@ -52,22 +52,16 @@ end
|
|||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|
||||||
module processor ( input clock, input reset , output reg [19:0] external_address_bus, inout [15:0] external_data_bus,output reg read, output reg write);
|
module processor ( input clock, input reset );
|
||||||
/* State */
|
|
||||||
reg [1:0] state;
|
reg [1:0] state;
|
||||||
reg start=0;
|
reg start=0;
|
||||||
reg instruction_finished;
|
reg instruction_finished;
|
||||||
|
|
||||||
/* Registers */
|
|
||||||
reg [19:0] ProgCount;
|
|
||||||
|
|
||||||
|
|
||||||
/* RESET LOGIC */
|
/* RESET LOGIC */
|
||||||
always @(negedge reset) begin
|
always @(negedge reset) begin
|
||||||
if (reset==0) begin
|
if (reset==0) begin
|
||||||
@(posedge clock);
|
@(posedge clock);
|
||||||
state=0;
|
state=0;
|
||||||
ProgCount=0;//TODO: Reset Vector
|
|
||||||
#10
|
#10
|
||||||
start=1;
|
start=1;
|
||||||
end
|
end
|
||||||
@ -92,13 +86,5 @@ always @(state) begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
/* Processor stages */
|
|
||||||
always @(state) begin
|
|
||||||
if (state==0) begin
|
|
||||||
external_address_bus <= ProgCount;
|
|
||||||
read <= 0;
|
|
||||||
write <= 1;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
@ -2,17 +2,11 @@ module tb;
|
|||||||
wire clock;
|
wire clock;
|
||||||
reg reset;
|
reg reset;
|
||||||
reg clk_enable;
|
reg clk_enable;
|
||||||
wire [19:0]address_bus;
|
|
||||||
wire [15:0]data_bus;
|
|
||||||
wire rd,wr,romcs;
|
|
||||||
|
|
||||||
processor p(clock,reset,address_bus,data_bus,rd,wr);
|
processor p(clock,reset);
|
||||||
rom bootrom(address_bus,data_bus,rd,romcs);
|
|
||||||
|
|
||||||
clock_gen #(.FREQ(1000)) u1(clk_enable, clock);
|
clock_gen #(.FREQ(1000)) u1(clk_enable, clock);
|
||||||
|
|
||||||
assign romcs=0;
|
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
$dumpfile("test.lx2");
|
$dumpfile("test.lx2");
|
||||||
$dumpvars(0,p);
|
$dumpvars(0,p);
|
||||||
|
Loading…
Reference in New Issue
Block a user