Hardware Reference
In-Depth Information
31
32
//FSM state register:
33
always_ff @(posedge clk, posedge rst)
34
if (rst) pr_state <= idle;
35
else pr_state <= nx_state;
36
37
//FSM combinational logic:
38
always_comb
39
case (pr_state)
40
idle: begin
41
i <= 1'b0;
42
y <= y_reg;
43
done <= 1'b1;
44
if (dv & ~x) nx_state <= load0;
45
else if (dv & x) nx_state <= load1;
46
else nx_state <= idle;
47
end
48
load0: begin
49
i <= i_reg + 1;
50
y <= y_reg;
51
y[i-1] <= 1'b0;
52
done <= 1'b0;
53
if (i=N) nx_state <= idle;
54
else if (x) nx_state <= load1;
55
else nx_state <= load0;
56
end
57
load1: begin
58
i <= i_reg + 1;
59
y <= y_reg;
60
y[i-1] <= 1'b1;
61
done <= 1'b0;
62
if (i=N) nx_state <= idle;
63
else if (~x) nx_state <= load0;
64
else nx_state <= load1;
65
end
66
endcase
67
68 endmodule
69 //-----------------------------------------------------------
13.6 Design of a Memory Interface
This section presents a SystemVerilog-based design for the memory interface intro-
duced in section 11.7.8 (i gure 11.16). The SRAM used in the experiments is the
IS61LV25616 device, from ISSI, which is capable of storing 262k 16-bit words. The
corresponding FSM was presented in i gure 11.16c, and the circuit ports are depicted
in i gure 13.1 (note that a test circuit has been included).
The i rst part of the code ( module header ) is in lines 1-19. The module's name is
sram_interface . Several global parameters were included for both the main circuit and
a test circuit. The port names are from i gure 13.1. All ports are of type logic .
Search WWH ::




Custom Search