Control Path Design and Lab 3
1
Control Path Design and Lab 3 1 Separating Control From Data The - - PowerPoint PPT Presentation
Control Path Design and Lab 3 1 Separating Control From Data The datapath is where data moves from place to place. Computation happens in the datapath No decisions are made here. Things you should find in a datapath Muxes
1
2
exploit.
chips.
and I will tell you to go fix the coding style issues first.
3
4
Control Datapath Signals controlling the datapath Signals providing information to control Outputs Data inputs Control inputs control outputs clk reset clk reset
5
6
7
8
9
@ (posedge clk)
10
11
always @(*) begin // Default is to stay in the same state state_next = state; case ( state ) STATE_1 : if ( something && something_else) state_next = ANOTHER_STATE; ANOTHER_STATE : if ( sky_falls ) state_next = SCREAM; SCREAM : state_next = WAIT; ... endcase end
12
always @(*) begin //Default control signals some_mux_sel_out = SOME_MUX_SEL_X; reg_en_out = 1'b0; case ( state ) STATE_1: begin some_mux_sel_out = 1’b1; end ANOTHER_STATE: if ( sufficient_happiness_in ) begin reg_en_out = 1’b1; end else if ( is_monday_in ) begin reg_en_out = 1’b0; end ... endcase end
13
always @(posedge clk) if (reset) state <= WAIT; else state <= state_next;
dff #( .WIDTH(3) ) state_dff ( .d(state_next), .q(state), .clk(clk), .reset(reset) );
14
IO READ IO WRITE HALT RUN
WRITE instruction
signal READ instruction in_ack signal HALT instruction
DMEM READ
LD instruction the following cycle
in_ack low
15
Run halt IO Read IO WRite DMem Read Run Halt IO READ IO Write DMem Read
16 Run Halt IO Read IO Write DMem Read run_stall_reset_sel dmem_write_en read_write_req reg_sel regfile_write_en op_code in_req out_req
17